oc-calendar: Use the calendar's time zone if it is present

If the event was created by the MAPI client, the client's time zone (if
present) is assigned to the event's calendar in iCalEvent+MAPIStore.
This way, we can use it to deliver the event's properties correctly.
This commit is contained in:
Juan Vallés
2015-12-16 18:49:09 +01:00
parent 4ae5feb131
commit 376e717f45
9 changed files with 73 additions and 119 deletions
+22
View File
@@ -40,6 +40,7 @@
#include <libmapi/libmapi.h>
#import "iCalTimeZone+MAPIStore.h"
#import "MAPIStoreTypes.h"
@interface iCalTimeZonePeriod (MAPIStorePropertiesPrivate)
@@ -352,4 +353,25 @@ end:
return tz;
}
/**
* Adjust a date in this vTimeZone to its representation in UTC
* Example: Timezone is +0001, the date is 2015-12-15 00:00:00 +0000
* it returns 2015-12-14 23:00:00 +0000
* @param date the date to adjust to the timezone.
* @return a new GMT date adjusted with the offset of the timezone.
*/
- (NSCalendarDate *) shiftedCalendarDateForDate: (NSCalendarDate *) date
{
NSCalendarDate *tmpDate;
tmpDate = [date copy];
[tmpDate autorelease];
[tmpDate setTimeZone: utcTZ];
return [tmpDate addYear: 0 month: 0 day: 0
hour: 0 minute: 0
second: -[[self periodForDate: tmpDate] secondsOffsetFromGMT]];
}
@end