ios - Compute previous or next date with EKRecurrenceRule -


i want compute previous date or next date offset nsdate , ekrecurrencerule. likes this:

nsdate* prevdate = [something computepreviousdateforoffsetdate: adate                                              withrecurrencerule: arule];  nsdate* nextdate = [something computenextdateforoffsetdate: adate                                         withrecurrencerule: arule]; 

i create something simple recurrence rule, complex rules pretty bit tough me. think pretty commonly needed things, asking this.

do have spend times implement own solution?

after loosing time ekrecurrencerule found alternative solution ios-rrule_parser easiest use , if cover needs.

for nextdate use this:

nsdate *startdate = [nsdate date]; nsdate *enddate = [startdate datebyaddingtimeinterval:100 *24 *60 *60];  scheduler * scheduler = [[scheduler alloc] initwithdate:startdate andrule:@"rrule:freq=daily;count=1;interval=2"]; nsarray *occurences = [scheduler occurencesbetween:startdate anddate:enddate];  nsdate *nextdate = [occurences objectatindex:0]; 

for previousdate change start date


Comments