From ba4964f2bd68765fab34be59681d2d04d79819d3 Mon Sep 17 00:00:00 2001 From: Daniel Spitzer Date: Wed, 22 Oct 2025 09:41:48 +0200 Subject: [PATCH] =?UTF-8?q?Kalender=20Update=20*=20=C3=9Cbergang=20Sommerz?= =?UTF-8?q?eit=20Winterzeit=20Bugfix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/Calendar/CalendarModel.php | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/application/Calendar/CalendarModel.php b/application/Calendar/CalendarModel.php index 01e9cd613..d68c9ecbf 100644 --- a/application/Calendar/CalendarModel.php +++ b/application/Calendar/CalendarModel.php @@ -92,6 +92,19 @@ class CalendarModel $unixtimestamp = $date->getTimestamp() + $cest; return date('Y-m-d H:i:s', $unixtimestamp); } + public static function convertMillisecondsToTimestamp($milliseconds) + { + $timestamp = $milliseconds / 1000; + $date = new DateTime(); + $date->setTimestamp($timestamp); + $date->setTimezone(new DateTimeZone('Europe/Berlin')); + if ($date->format('I') == 1) { + $offset = 7200; + } else { + $offset = 3600; + } + return $timestamp - $offset; + } public static function replace_unicode_sequences($string) { @@ -646,12 +659,8 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda public static function updateCalendarEvent($r, $me) { - $description = ($r->description); - $attachments = ($r->attachments); - $location = ($r->location); - $title = ($r->title); - $start = ((($r->start - 7200000) / 1000)); - $end = ((($r->end - 7200000) / 1000)); + $start = CalendarModel::convertMillisecondsToTimestamp($r->start); + $end = CalendarModel::convertMillisecondsToTimestamp($r->end); if ($title) {