Fix negative offset when saving an all-day event

Fixes #3717
pull/213/head
Francis Lachapelle 2016-06-06 13:29:00 -04:00
parent e54d5c1b06
commit ec61fd10fc
2 changed files with 13 additions and 15 deletions

1
NEWS
View File

@ -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)
------------------

View File

@ -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