diff --git a/NEWS b/NEWS index 6b064e6c5..387e04f3d 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,7 @@ Enhancements Bug fixes - [core] yearly repeating events are not shown in web calendar (#4237) - [core] correctly handle "Last day of the month" recurrence rule + - [core] fixed yearly recurrence calculator with until date - [eas] avoid sync requests for shared folders every second (#4275) 2.3.22 (2017-07-20) diff --git a/SOPE/NGCards/iCalYearlyRecurrenceCalculator.m b/SOPE/NGCards/iCalYearlyRecurrenceCalculator.m index 0aa339750..aa5e9c4fc 100644 --- a/SOPE/NGCards/iCalYearlyRecurrenceCalculator.m +++ b/SOPE/NGCards/iCalYearlyRecurrenceCalculator.m @@ -91,7 +91,7 @@ if ([lastDate compare: rStart] == NSOrderedAscending) // Range starts after last occurrence return nil; - if ([lastDate compare: rEnd] == NSOrderedDescending) + if ([lastDate compare: rEnd] == NSOrderedAscending) // Range ends after last occurence; adjust end date rEnd = lastDate; } @@ -212,14 +212,17 @@ months: 0 days: 0]; [start setTimeZone: [firStart timeZone]]; - end = [start addTimeInterval: [firstRange duration]]; - r = [NGCalendarDateRange calendarDateRangeWithStartDate: start - endDate: end]; - if ([_r doesIntersectWithDateRange: r] && (repeatCount == 0 || count < repeatCount)) - { - [ranges addObject: r]; - count++; - } + if ([start compare: rEnd] == NSOrderedAscending) + { + end = [start addTimeInterval: [firstRange duration]]; + r = [NGCalendarDateRange calendarDateRangeWithStartDate: start + endDate: end]; + if ([_r doesIntersectWithDateRange: r] && (repeatCount == 0 || count < repeatCount)) + { + [ranges addObject: r]; + count++; + } + } } } else