From 7ea6c338d3cfff329eecd026ba1cea52b1faad22 Mon Sep 17 00:00:00 2001 From: ralf Date: Fri, 2 Aug 2024 16:09:15 +0200 Subject: [PATCH] fixing whole-day events get one day shorter when editing them in EGroupware (caused by yesterdays whole-day with timezone fix for TB) --- api/src/DateTime.php | 1 + calendar/inc/class.calendar_boupdate.inc.php | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/api/src/DateTime.php b/api/src/DateTime.php index bfa0d48d0c..ccf23341f8 100644 --- a/api/src/DateTime.php +++ b/api/src/DateTime.php @@ -193,6 +193,7 @@ class DateTime extends \DateTime * Like DateTime::add, but additional allow to use a string run through DateInterval::createFromDateString * * @param DateInterval|string $interval eg. '1 day', '-2 weeks' + * @returns DateTime the modified object to allow chaning */ public function add($interval) : \DateTime { diff --git a/calendar/inc/class.calendar_boupdate.inc.php b/calendar/inc/class.calendar_boupdate.inc.php index cd94d84891..35e465bb67 100644 --- a/calendar/inc/class.calendar_boupdate.inc.php +++ b/calendar/inc/class.calendar_boupdate.inc.php @@ -1559,7 +1559,9 @@ class calendar_boupdate extends calendar_bo } if (!empty($event['end'])) { - $time = $this->so->startOfDay(new Api\DateTime($event['end'], Api\DateTime::$user_timezone)); + // as EGroupware end of whole-day events is 1sec (or sometimes 60sec) shorter, we have to add 60sec, + // before calling startOfDay to NOT lose one day + $time = $this->so->startOfDay((new Api\DateTime($event['end'], Api\DateTime::$user_timezone))->add('60seconds')); $time->add('-1second'); $event['end'] = Api\DateTime::to($time, 'ts'); $save_event['end'] = $time;