Skip to content

Commit

Permalink
fix(mail): fix end date of all-day event in mail notifications
Browse files Browse the repository at this point in the history
Fixes #5384
  • Loading branch information
cgx committed Sep 7, 2021
1 parent ea6b699 commit ef5820b
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions SoObjects/Appointments/SOGoAptMailUpdate.m
Expand Up @@ -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
Expand All @@ -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++)
Expand Down Expand Up @@ -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"];

Expand Down

0 comments on commit ef5820b

Please sign in to comment.