From 4156dc77fc07e905cdbcdc12eb2e08dbef9ac42e Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Wed, 22 Aug 2012 01:26:05 +0000 Subject: [PATCH 1/2] See ChangeLog. Monotone-Parent: e85beb8f93ffc2c69838b75d3a43926981cbe855 Monotone-Revision: 6722e59df0723e9698a938cf20033b44e842756f Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2012-08-22T01:26:05 --- SOPE/NGCards/ChangeLog | 5 +++++ SOPE/NGCards/iCalRepeatableEntityObject.m | 15 ++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/SOPE/NGCards/ChangeLog b/SOPE/NGCards/ChangeLog index 00e9c352b..1fe2c27c8 100644 --- a/SOPE/NGCards/ChangeLog +++ b/SOPE/NGCards/ChangeLog @@ -1,3 +1,8 @@ +2012-08-21 Francis Lachapelle + + * iCalRepeatableEntityObject.m (-exceptionDatesWithTimeZone:): we + now consider the timezone of the EXDATE, if defined. + 2012-05-30 Francis Lachapelle * iCalRepeatableEntityObject.m (-exceptionDatesWithTimeZone:) diff --git a/SOPE/NGCards/iCalRepeatableEntityObject.m b/SOPE/NGCards/iCalRepeatableEntityObject.m index 66173119e..4cc9437a3 100644 --- a/SOPE/NGCards/iCalRepeatableEntityObject.m +++ b/SOPE/NGCards/iCalRepeatableEntityObject.m @@ -33,6 +33,7 @@ #import "iCalDateTime.h" #import "iCalEvent.h" #import "iCalTimeZone.h" +#import "iCalTimeZonePeriod.h" #import "iCalRecurrenceRule.h" #import "iCalRecurrenceCalculator.h" #import "iCalRepeatableEntityObject.h" @@ -258,19 +259,19 @@ while ((dateString = [dateList nextObject])) { - exDates = [(iCalDateTime*) dateString valuesAtIndex: 0 forKey: @""]; - for (i = 0; i < [exDates count]; i++) + exDates = [(iCalDateTime*) dateString dateTimes]; + for (i = 0; i < [exDates count]; i++) { - dateString = [exDates objectAtIndex: i]; + exDate = [exDates objectAtIndex: i]; + + // Example: timezone is -0400, date is 2012-05-24 (00:00:00 +0000), + // and changes to 2012-05-24 04:00:00 +0000 if ([theTimeZone isKindOfClass: [iCalTimeZone class]]) { - exDate = [(iCalTimeZone *) theTimeZone computedDateForString: dateString]; + exDate = [(iCalTimeZone *) theTimeZone computedDateForDate: exDate]; } else { - // Example: timezone is -0400, date is 2012-05-24 (00:00:00 +0000), - // and changes to 2012-05-24 04:00:00 +0000 - exDate = [dateString asCalendarDate]; offset = [(NSTimeZone *) theTimeZone secondsFromGMTForDate: exDate]; exDate = (NSCalendarDate *) [exDate dateByAddingYears:0 months:0 days:0 hours:0 minutes:0 seconds:-offset]; From 426696b03360fc6b4b3c29206f6b0264cb93b2fc Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Wed, 22 Aug 2012 13:49:45 +0000 Subject: [PATCH 2/2] See ChangeLog. Monotone-Parent: 6722e59df0723e9698a938cf20033b44e842756f Monotone-Revision: 52bc1ab2a2dcc4de7809fd592d0e9c41c556cf17 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2012-08-22T13:49:45 --- SOPE/NGCards/ChangeLog | 6 ++++++ SOPE/NGCards/iCalWeeklyRecurrenceCalculator.m | 6 ++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/SOPE/NGCards/ChangeLog b/SOPE/NGCards/ChangeLog index 1fe2c27c8..e5922829f 100644 --- a/SOPE/NGCards/ChangeLog +++ b/SOPE/NGCards/ChangeLog @@ -1,3 +1,9 @@ +2012-08-22 Francis Lachapelle + + * iCalWeeklyRecurrenceCalculator.m + (-recurrenceRangesWithinCalendarDateRange:): fixed validation of + the interval when a day mask is used on multiple days. + 2012-08-21 Francis Lachapelle * iCalRepeatableEntityObject.m (-exceptionDatesWithTimeZone:): we diff --git a/SOPE/NGCards/iCalWeeklyRecurrenceCalculator.m b/SOPE/NGCards/iCalWeeklyRecurrenceCalculator.m index f49536646..140d05531 100644 --- a/SOPE/NGCards/iCalWeeklyRecurrenceCalculator.m +++ b/SOPE/NGCards/iCalWeeklyRecurrenceCalculator.m @@ -118,8 +118,8 @@ currentStartDate = [firStart copy]; [currentStartDate autorelease]; ranges = [NSMutableArray array]; - i = 0; count = 0; + i = [currentStartDate dayOfWeek]; // Set the first day of the week as Sunday and ignore WKST if (dayMask == nil) { @@ -158,7 +158,7 @@ [startDate compare: currentStartDate] == NSOrderedSame) { // If the rule count is defined, stop once the count is reached. - if (i == 0) + if ([currentStartDate compare: firStart] == NSOrderedSame) { // Always add the start date of the recurring event if within // the lookup range. @@ -166,8 +166,6 @@ } else { - // The following always set the first day of the week as the day - // of the master event start date, ie WKST is ignored. week = i / 7; if ((week % interval) == 0 &&