From b46ffe237f1fa66e87e3d71190234167b3ce1913 Mon Sep 17 00:00:00 2001 From: Moritz Strohm <strohm@data-quest.de> Date: Fri, 22 Mar 2024 10:21:34 +0100 Subject: [PATCH] calendar/date/add: remove one second for dates that fullcalendar marked as all-day --- app/controllers/calendar/date.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/controllers/calendar/date.php b/app/controllers/calendar/date.php index cd876ed76f4..a618a3d9c89 100644 --- a/app/controllers/calendar/date.php +++ b/app/controllers/calendar/date.php @@ -358,6 +358,14 @@ class Calendar_DateController extends AuthenticatedController $this->all_day_event = false; if ($mode === 'add' && Request::get('all_day') === '1') { $this->all_day_event = true; + //Check for a fullcalendar all-day event ending. In that case, remove one second to have an all-day event + //that abides to the Stud.IP rules. + $end = new DateTime(); + $end->setTimestamp($this->date->end); + if ($end->format('His') === '000000') { + $end = $end->sub(new DateInterval('PT1S')); + } + $this->date->end = $end->getTimestamp(); } else { $begin = new DateTime(); $begin->setTimestamp(intval($this->date->begin)); -- GitLab