I am currently using the following filter to retrieve a list of data within a specific date range. I have implemented logic in the component where I check the length of the list and assign True or False to a variable based on that. I am wondering if there is a way to directly return a boolean and if this method is correct?
export const selectModel = (planedDate: Date) => createSelector(
selectDrugReviews,
(reviews: ReviewModel[]) => reviews.filter(date => date.startDateTime.getTime() <= planedDate.getTime() && (date.endDateTime !== undefined ? date.endDateTime.getTime() >= planedDate.getTime() : true))
);