From 1bd2798ae82873cef9061b30ad470bb071bde788 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 19 Oct 2010 02:59:09 +0000 Subject: [PATCH] Monotone-Parent: 09e07a1c8e00beee8c2f4bdeebb726ac5f57b9e9 Monotone-Revision: 8e38cd34311edbce1f6a5d645e0e49644ad94473 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-10-19T02:59:09 Monotone-Branch: ca.inverse.sogo --- SOPE/NGCards/ChangeLog | 4 ++++ SOPE/NGCards/iCalTimeZone.m | 17 +++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) 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