I have a core data context with objects that have a date stored in them. I would like to get the data for only the current week (Monday to Sunday) in that order. I am not looking for the last 7 days.
The date could be the one stored inside the entity or the data of when the object was added to core data (they are the same).
I can use a predicate with a start date and end date like this:
NSPredicate *weekPredicate = [NSPredicate predicateWithFormat:@"((date > %@) AND (date <= %@)) || (date = nil)",startDate,endDate];
but how do I calculate startDate and endDate?
1 Answer