From 35ca313c37c2efbf99c62a81b1ef8b5564e74884 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20J=2E=20Hern=C3=A1ndez=20Blasco?= Date: Thu, 16 Oct 2014 16:29:23 +0200 Subject: [PATCH] oc-calendar: Fix PidLidClipStart on recurrent events The midnight value must be in user's timezone and returned back in UTC. --- OpenChange/MAPIStoreAppointmentWrapper.m | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/OpenChange/MAPIStoreAppointmentWrapper.m b/OpenChange/MAPIStoreAppointmentWrapper.m index 968b3dc66..f459462be 100644 --- a/OpenChange/MAPIStoreAppointmentWrapper.m +++ b/OpenChange/MAPIStoreAppointmentWrapper.m @@ -791,11 +791,20 @@ static NSCharacterSet *hexCharacterSet = nil; inMemCtx: (TALLOC_CTX *) memCtx { enum mapistore_error rc; - NSCalendarDate *dateValue; + NSCalendarDate *dateValue, *start; if ([event isRecurrent]) { - dateValue = [[event startDate] hour: 0 minute: 0 second: 0]; + /* [MS-OXOCAL] For a recurring series, this property specifies + midnight in the user's machine time zone, on the date of the + first instance, then is persisted in UTC. */ + start = [event startDate]; + dateValue = [NSCalendarDate dateWithYear: [start yearOfCommonEra] + month: [start monthOfYear] + day: [start dayOfMonth] + hour: 0 minute: 0 second: 0 + timeZone: timeZone]; + [dateValue setTimeZone: utcTZ]; *data = [dateValue asFileTimeInMemCtx: memCtx]; rc = MAPISTORE_SUCCESS; }