diff --git a/SOPE/NGCards/ChangeLog b/SOPE/NGCards/ChangeLog index 8e3f530ed..591a9a914 100644 --- a/SOPE/NGCards/ChangeLog +++ b/SOPE/NGCards/ChangeLog @@ -1,5 +1,9 @@ 2010-10-18 Wolfgang Sourdeau + * 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 to deduct the offset from UTC from the resulting date since "tzStart" is already relative to UTC. diff --git a/SOPE/NGCards/iCalTimeZone.m b/SOPE/NGCards/iCalTimeZone.m index 101000836..1f61abc49 100644 --- a/SOPE/NGCards/iCalTimeZone.m +++ b/SOPE/NGCards/iCalTimeZone.m @@ -220,14 +220,23 @@ static NSMutableDictionary *cache; - (NSCalendarDate *) dateForDateTimeString: (NSString *) string { NSCalendarDate *tmpDate; - iCalTimeZonePeriod *period; + iCalTimeZonePeriod *period, *realPeriod; tmpDate = [string asCalendarDate]; period = [self periodForDate: tmpDate]; + tmpDate = [tmpDate addYear: 0 month: 0 day: 0 + hour: 0 minute: 0 + second: -[period secondsOffsetFromGMT]]; - return [tmpDate addYear: 0 month: 0 day: 0 - hour: 0 minute: 0 - 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