mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-11-22 15:14:21 +00:00
(fix) fixed handling of exdates and proper intersection for fbinfo (fixes #4051)
This commit is contained in:
1 parent
2f56bb43be
commit
84deb2fe45
3 files changed
+10
-9
No files matched your search
@@ -161,10 +161,12 @@ static Class yearlyCalcClass = Nil;
|
||||
|
||||
+ (NSArray *) _dates: (NSArray *) dateList
|
||||
withinRange: (NGCalendarDateRange *) limits
|
||||
startingWithDate: (NGCalendarDateRange *) first
|
||||
{
|
||||
NSMutableArray *newDates;
|
||||
NSEnumerator *dates;
|
||||
NSCalendarDate *currentDate;
|
||||
NGCalendarDateRange *currentRange;
|
||||
|
||||
newDates = [NSMutableArray array];
|
||||
|
||||
@@ -173,7 +175,10 @@ static Class yearlyCalcClass = Nil;
|
||||
{
|
||||
if ([currentDate isKindOfClass: NSStringClass])
|
||||
currentDate = [(NSString *) currentDate asCalendarDate];
|
||||
if ([limits containsDate: currentDate])
|
||||
|
||||
currentRange = [NGCalendarDateRange calendarDateRangeWithStartDate: currentDate
|
||||
endDate: [currentDate dateByAddingYears: 0 months: 0 days: 0 hours: 0 minutes: 0 seconds: [first duration]]];
|
||||
if ([limits doesIntersectWithDateRange: currentRange])
|
||||
[newDates addObject: currentDate];
|
||||
}
|
||||
|
||||
@@ -191,7 +196,7 @@ static Class yearlyCalcClass = Nil;
|
||||
unsigned int count, maxRanges;
|
||||
NSComparisonResult compare;
|
||||
|
||||
dates = [[self _dates: exdates withinRange: limits] objectEnumerator];
|
||||
dates = [[self _dates: exdates withinRange: limits startingWithDate: first] objectEnumerator];
|
||||
while ((currentDate = [dates nextObject]))
|
||||
{
|
||||
maxRanges = [ranges count];
|
||||
|
||||
@@ -191,7 +191,7 @@
|
||||
for (k = 0; k < [rangesInMonth count] && (repeatCount == 0 || count < repeatCount); k++) {
|
||||
//NSLog(@"*** YEARLY found %@ (count = %i)", [[rangesInMonth objectAtIndex: k] startDate], count);
|
||||
count++;
|
||||
if ([_r containsDateRange: [rangesInMonth objectAtIndex: k]])
|
||||
if ([_r doesIntersectWithDateRange: [rangesInMonth objectAtIndex: k]])
|
||||
{
|
||||
[ranges addObject: [rangesInMonth objectAtIndex: k]];
|
||||
//NSLog(@"*** YEARLY adding %@ (count = %i)", [[rangesInMonth objectAtIndex: k] startDate], count);
|
||||
@@ -215,7 +215,7 @@
|
||||
end = [start addTimeInterval: [firstRange duration]];
|
||||
r = [NGCalendarDateRange calendarDateRangeWithStartDate: start
|
||||
endDate: end];
|
||||
if ([_r containsDateRange: r] && (repeatCount == 0 || count < repeatCount))
|
||||
if ([_r doesIntersectWithDateRange: r] && (repeatCount == 0 || count < repeatCount))
|
||||
{
|
||||
[ranges addObject: r];
|
||||
count++;
|
||||
|
||||
Reference in new issue
Block a user