diff --git a/ActiveSync/iCalEvent+ActiveSync.m b/ActiveSync/iCalEvent+ActiveSync.m index a6b4c80f0..8b15a6d8d 100644 --- a/ActiveSync/iCalEvent+ActiveSync.m +++ b/ActiveSync/iCalEvent+ActiveSync.m @@ -84,6 +84,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. int v; + NSTimeZone *userTimeZone; + userTimeZone = [[[context activeUser] userDefaults] timeZone]; + s = [NSMutableString string]; [s appendFormat: @"%d", ([self isAllDay] ? 1 : 0)]; @@ -96,12 +99,30 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // StartTime -- http://msdn.microsoft.com/en-us/library/ee157132(v=exchg.80).aspx if ([self startDate]) - [s appendFormat: @"%@", [[self startDate] activeSyncRepresentationWithoutSeparatorsInContext: context]]; - + { + if ([self isAllDay]) + [s appendFormat: @"%@", + [[[self startDate] dateByAddingYears: 0 months: 0 days: 0 + hours: 0 minutes: 0 + seconds: ([userTimeZone secondsFromGMTForDate: [self startDate]])*-1] + activeSyncRepresentationWithoutSeparatorsInContext: context]]; + else + [s appendFormat: @"%@", [[self startDate] activeSyncRepresentationWithoutSeparatorsInContext: context]]; + } + // EndTime -- http://msdn.microsoft.com/en-us/library/ee157945(v=exchg.80).aspx if ([self endDate]) - [s appendFormat: @"%@", [[self endDate] activeSyncRepresentationWithoutSeparatorsInContext: context]]; - + { + if ([self isAllDay]) + [s appendFormat: @"%@", + [[[self endDate] dateByAddingYears: 0 months: 0 days: 0 + hours: 0 minutes: 0 + seconds: ([userTimeZone secondsFromGMTForDate: [self endDate]])*-1] + activeSyncRepresentationWithoutSeparatorsInContext: context]]; + else + [s appendFormat: @"%@", [[self endDate] activeSyncRepresentationWithoutSeparatorsInContext: context]]; + } + // Timezone tz = [(iCalDateTime *)[self firstChildWithTag: @"dtstart"] timeZone]; @@ -364,6 +385,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. if (isAllDay) { + tzOffset = [userTimeZone secondsFromGMTForDate: o]; + o = [o dateByAddingYears: 0 months: 0 days: 0 + hours: 0 minutes: 0 + seconds: tzOffset]; [start setDate: o]; [start setTimeZone: nil]; } @@ -385,6 +410,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. if (isAllDay) { + tzOffset = [userTimeZone secondsFromGMTForDate: o]; + o = [o dateByAddingYears: 0 months: 0 days: 0 + hours: 0 minutes: 0 + seconds: tzOffset]; [end setDate: o]; [end setTimeZone: nil]; } diff --git a/NEWS b/NEWS index 39762c77d..e3004511b 100644 --- a/NEWS +++ b/NEWS @@ -11,6 +11,7 @@ Bug fixes - fixed the ActiveSync issue marking all mails as read when downloading them - fixed ActiveSync's move operations not working for multiple selections (#2691) - fixed email validation regexp to allow gTLDs + - improved all-day events support for ActiveSync (#2686) 2.2.2 (2014-03-21) ------------------