From ef5820b49bfd8f3f53b5d6e6070bc5e2c970603b Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Tue, 7 Sep 2021 16:51:11 -0400 Subject: [PATCH] fix(mail): fix end date of all-day event in mail notifications Fixes #5384 --- SoObjects/Appointments/SOGoAptMailUpdate.m | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/SoObjects/Appointments/SOGoAptMailUpdate.m b/SoObjects/Appointments/SOGoAptMailUpdate.m index 2c2009775b..c52dd347e0 100644 --- a/SoObjects/Appointments/SOGoAptMailUpdate.m +++ b/SoObjects/Appointments/SOGoAptMailUpdate.m @@ -87,11 +87,17 @@ - (NSString *) valueForProperty: (NSString *) property value = [(iCalEvent *) apt propertyValue: property]; if ([valueType isEqualToString: @"date"]) { - [value setTimeZone: viewTZ]; - if ([apt isAllDay]) - value = [_dateFormatter formattedDate: value]; + if ([(iCalEvent *) apt isAllDay]) + { + if ([property isEqualToString: @"endDate"]) + value = [(NSCalendarDate *) value dateByAddingYears:0 months:0 days:0 hours:0 minutes:0 seconds:-1]; + value = [_dateFormatter formattedDate: value]; + } else - value = [_dateFormatter formattedDateAndTime: value]; + { + [value setTimeZone: viewTZ]; + value = [_dateFormatter formattedDateAndTime: value]; + } } } else @@ -106,8 +112,8 @@ - (void) _setupBodyContentWithFormatter: (SOGoDateFormatter *) _dateFormatter NSArray *updatedProperties; int count, max; - updatedProperties = [[iCalEventChanges changesFromEvent: previousApt - toEvent: apt] + updatedProperties = [[iCalEventChanges changesFromEvent: (iCalEvent *) previousApt + toEvent: (iCalEvent *) apt] updatedProperties]; max = [updatedProperties count]; for (count = 0; count < max; count++) @@ -170,7 +176,7 @@ - (void) setupValues [values setObject: [localDateFormatter shortFormattedDate: date] forKey: @"OldStartDate"]; - if (![apt isAllDay]) + if (![(iCalEvent *) apt isAllDay]) [values setObject: [localDateFormatter formattedTime: date] forKey: @"OldStartTime"];