i have an array of entities with date objects in relationship end. I know how to filter out objects for given dates or date ranges using predicates. my situation is that now i need to filter out objects matching a given value of a calendar unit. like year 2001 or month 4.
now for year this seems simple cause i can just make a start date and end date with jan 1 and dec 31 for given year. but for month week this is an impossible task to calulate start and end dates of each week or even months as there are leap years. there has to be a simpler way where i can just mention in the predicate as to which date component i want to be matched.
please let me know how to do it.
thanks.