Monotone-Parent: 09e07a1c8e00beee8c2f4bdeebb726ac5f57b9e9

Monotone-Revision: 8e38cd34311edbce1f6a5d645e0e49644ad94473

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2010-10-19T02:59:09
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2010-10-19 02:59:09 +00:00
parent 6484ed17fe
commit 1bd2798ae8
2 changed files with 17 additions and 4 deletions

View File

@ -1,5 +1,9 @@
2010-10-18 Wolfgang Sourdeau <wsourdeau@inverse.ca> 2010-10-18 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* iCalTimeZone.m (-dateForDateTimeString:): adjust dates since
they are passed as UTC and may not match the timezone's DST
switches. A bit dirty but good for now...
* iCalTimeZonePeriod.m (_occurenceForDate:byRRule:): we don't need * iCalTimeZonePeriod.m (_occurenceForDate:byRRule:): we don't need
to deduct the offset from UTC from the resulting date since to deduct the offset from UTC from the resulting date since
"tzStart" is already relative to UTC. "tzStart" is already relative to UTC.

View File

@ -220,14 +220,23 @@ static NSMutableDictionary *cache;
- (NSCalendarDate *) dateForDateTimeString: (NSString *) string - (NSCalendarDate *) dateForDateTimeString: (NSString *) string
{ {
NSCalendarDate *tmpDate; NSCalendarDate *tmpDate;
iCalTimeZonePeriod *period; iCalTimeZonePeriod *period, *realPeriod;
tmpDate = [string asCalendarDate]; tmpDate = [string asCalendarDate];
period = [self periodForDate: tmpDate]; period = [self periodForDate: tmpDate];
tmpDate = [tmpDate addYear: 0 month: 0 day: 0
return [tmpDate addYear: 0 month: 0 day: 0
hour: 0 minute: 0 hour: 0 minute: 0
second: -[period secondsOffsetFromGMT]]; second: -[period secondsOffsetFromGMT]];
#warning this is a dirty hack due to the fact that the date is first passed as UTC
realPeriod = [self periodForDate: tmpDate];
if (realPeriod != period)
tmpDate = [tmpDate addYear: 0 month: 0 day: 0
hour: 0 minute: 0
second: ([period secondsOffsetFromGMT]
- [realPeriod secondsOffsetFromGMT])];
return tmpDate;
} }
@end @end