@@ -80,6 +80,9 @@ class RotationConfigForm extends CompatForm
8080 /** @var int The rotation id */
8181 protected $ rotationId ;
8282
83+ /** @var string The timezone to display the timeline in */
84+ protected $ displayTimezone ;
85+
8386 /**
8487 * Set the label for the submit button
8588 *
@@ -187,11 +190,13 @@ public function hasBeenWiped(): bool
187190 *
188191 * @param int $scheduleId
189192 * @param Connection $db
193+ * @param string $displayTimezone
190194 */
191- public function __construct (int $ scheduleId , Connection $ db )
195+ public function __construct (int $ scheduleId , Connection $ db, string $ displayTimezone )
192196 {
193197 $ this ->db = $ db ;
194198 $ this ->scheduleId = $ scheduleId ;
199+ $ this ->displayTimezone = $ displayTimezone ;
195200 }
196201
197202 /**
@@ -1300,12 +1305,25 @@ private function getTimeOptions(): array
13001305 \IntlDateFormatter::SHORT
13011306 );
13021307
1308+ $ dtzFormatter = new \IntlDateFormatter (
1309+ \Locale::getDefault (),
1310+ \IntlDateFormatter::NONE ,
1311+ \IntlDateFormatter::SHORT ,
1312+ $ this ->displayTimezone
1313+ );
1314+
13031315 $ options = [];
1304- $ dt = new DateTime ();
1316+ $ dt = new DateTime (' now ' , new DateTimeZone ( $ this -> getScheduleTimezone ()) );
13051317 for ($ hour = 0 ; $ hour < 24 ; $ hour ++) {
13061318 for ($ minute = 0 ; $ minute < 60 ; $ minute += 30 ) {
13071319 $ dt ->setTime ($ hour , $ minute );
1308- $ options [$ dt ->format ('H:i ' )] = $ formatter ->format ($ dt );
1320+ $ dtzDt = (clone $ dt )->setTimezone (new DateTimeZone ($ this ->displayTimezone ));
1321+
1322+ $ options [$ dt ->format ('H:i ' )] = sprintf (
1323+ '%s (%s) ' ,
1324+ $ formatter ->format ($ dt ),
1325+ $ dtzFormatter ->format ($ dtzDt )
1326+ );
13091327 }
13101328 }
13111329
0 commit comments