diff --git a/NEWS b/NEWS index ddd80b850..9f61c4ebe 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,7 @@ Bug fixes - [web] fixed event classification icon (private/confidential) in month view (#3711) - [web] CKEditor: added the pastefromword plugin (#2295, #3313) - [web] fixed loading of card from global addressbooks + - [web] fixed negative offset when saving an all-day event (#3717) 3.1.1 (2016-06-02) ------------------ diff --git a/SoObjects/Appointments/iCalEvent+SOGo.m b/SoObjects/Appointments/iCalEvent+SOGo.m index 3924dd998..7d2bedb58 100644 --- a/SoObjects/Appointments/iCalEvent+SOGo.m +++ b/SoObjects/Appointments/iCalEvent+SOGo.m @@ -338,9 +338,8 @@ - (void) setAttributes: (NSDictionary *) data inContext: (WOContext *) context { - NSCalendarDate *aptStartDate, *aptEndDate, *allDayStartDate; - NSTimeZone *timeZone; - NSInteger offset, nbrDays; + NSCalendarDate *aptStartDate, *aptEndDate; + NSInteger nbrDays; iCalDateTime *startDate; iCalTimeZone *tz; SOGoUserDefaults *ud; @@ -370,6 +369,16 @@ { if (isAllDay) { + // Remove the vTimeZone when dealing with an all-day event. + startDate = (iCalDateTime *)[self uniqueChildWithTag: @"dtstart"]; + tz = [startDate timeZone]; + if (tz) + { + [startDate setTimeZone: nil]; + [(iCalDateTime *)[self uniqueChildWithTag: @"dtend"] setTimeZone: nil]; + [[self parent] removeChild: tz]; + } + nbrDays = ((float) abs ([aptEndDate timeIntervalSinceDate: aptStartDate]) / 86400) + 1; [self setAllDayWithStartDate: aptStartDate duration: nbrDays]; @@ -405,18 +414,6 @@ } } } - else // if (![[self clientObject] isNew]) - { - // Remove the vTimeZone when dealing with an all-day event. - startDate = (iCalDateTime *)[self uniqueChildWithTag: @"dtstart"]; - tz = [startDate timeZone]; - if (tz) - { - [startDate setTimeZone: nil]; - [(iCalDateTime *)[self uniqueChildWithTag: @"dtend"] setTimeZone: nil]; - [[self parent] removeChild: tz]; - } - } } @end