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) {