@@ -230,7 +230,11 @@ public function loadRotation(int $rotationId): self
230230 throw new LogicException ('Invalid mode ' );
231231 }
232232
233- $ handoff = DateTime::createFromFormat ('Y-m-d H:i ' , $ rotation ->first_handoff . ' ' . $ time );
233+ $ handoff = DateTime::createFromFormat (
234+ 'Y-m-d H:i ' ,
235+ $ rotation ->first_handoff . ' ' . $ time ,
236+ new DateTimeZone ($ this ->displayTimezone )
237+ );
234238 if ($ handoff === false ) {
235239 throw new ConfigurationError ('Invalid date format ' );
236240 }
@@ -261,7 +265,9 @@ public function loadRotation(int $rotationId): self
261265 ->orderBy ('until_time ' , SORT_DESC )
262266 ->first ();
263267 if ($ previousShift !== null ) {
264- $ this ->previousShift = $ previousShift ->until_time ;
268+ $ this ->previousShift = $ previousShift ->until_time ->setTimezone (
269+ new DateTimeZone ($ this ->displayTimezone )
270+ );
265271 }
266272
267273 /** @var ?Rotation $newerRotation */
@@ -455,6 +461,9 @@ public function editRotation(int $rotationId): void
455461 ->filter (Filter::equal ('timeperiod.owned_by_rotation_id ' , $ rotationId ));
456462
457463 foreach ($ timeperiodEntries as $ timeperiodEntry ) {
464+ $ timeperiodEntry ->start_time ->setTimezone ($ this ->getScheduleTimezone ());
465+ $ timeperiodEntry ->end_time ->setTimezone ($ this ->getScheduleTimezone ());
466+
458467 /** @var TimeperiodEntry $timeperiodEntry */
459468 $ rrule = $ timeperiodEntry ->toRecurrenceRule ();
460469 $ shiftDuration = $ timeperiodEntry ->start_time ->diff ($ timeperiodEntry ->end_time );
0 commit comments