(fix) make sure we handle events occurring after RRULE's UNTIL date

This commit is contained in:
Ludovic Marcotte
2019-09-12 10:23:51 -04:00
parent 1e0bea5988
commit 1ee23a6bec
2 changed files with 19 additions and 0 deletions

1
NEWS
View File

@@ -23,6 +23,7 @@ Bug fixes
- [core] honor groups when setting IMAP ACLs
- [core] honor "any authenticated user" when setting IMAP ACLs
- [core] avoid exceptions for RRULE with no DTSTART
- [core] make sure we handle events occurring after RRULE's UNTIL date
4.0.8 (2019-07-19)
------------------

View File

@@ -175,6 +175,8 @@
if ([self isRecurrent])
{
NSCalendarDate *date;
NSArray *events;
iCalEvent *e;
date = [self lastPossibleRecurrenceStartDate];
if (date)
@@ -183,6 +185,22 @@
/* this could also be *nil*, but in the end it makes the fetchspecs
more complex - thus we set it to a "reasonable" distant future */
date = iCalDistantFuture;
// We have to make sure that we don't have occurrences that are after
// our -lastPossibleRecurrenceStartDate. We do that by walking through
// the events list from the calendar component
events = [[self parent] events];
for (i = 0; i < [events count]; i++)
{
e = [events objectAtIndex: i];
if ([e recurrenceId] && [[e startDate] compare: date] == NSOrderedDescending)
{
date = [e startDate];
date = [date addTimeInterval: [e durationAsTimeInterval]];
}
}
[row setObject: [self quickRecordDateAsNumber: date
withOffset: 0 forAllDay: NO]
forKey: @"c_cycleenddate"];