@@ -1242,7 +1242,7 @@ function ($value, $validator) use ($earliestHandoff, $firstHandoff, $latestHando
12421242 if ($ actualFirstHandoff < new DateTime ()) {
12431243 return $ this ->translate ('The rotation will start immediately ' );
12441244 } else {
1245- $ handoffHint = sprintf (
1245+ return sprintf (
12461246 $ this ->translate ('The rotation will start on %s ' ),
12471247 (new \IntlDateFormatter (
12481248 \Locale::getDefault (),
@@ -1251,15 +1251,37 @@ function ($value, $validator) use ($earliestHandoff, $firstHandoff, $latestHando
12511251 $ this ->scheduleTimezone
12521252 ))->format ($ actualFirstHandoff )
12531253 );
1254-
1255- if ($ this ->displayTimezone !== $ this ->scheduleTimezone ) {
1256- $ handoffHint .= sprintf ($ this ->translate (' (in %s) ' ), $ this ->scheduleTimezone );
1257- }
1258-
1259- return $ handoffHint ;
12601254 }
12611255 })
12621256 ));
1257+ if ($ this ->displayTimezone !== $ this ->scheduleTimezone ) {
1258+ $ this ->addHtml (new HtmlElement (
1259+ 'p ' ,
1260+ Attributes::create (['id ' => 'first-handoff-display-timezone-hint ' ]),
1261+ DeferredText::create (function () {
1262+ $ ruleGenerator = $ this ->yieldRecurrenceRules (1 );
1263+ if (! $ ruleGenerator ->valid ()) {
1264+ return '' ;
1265+ }
1266+
1267+ $ actualFirstHandoff = $ ruleGenerator ->current ()[0 ]->getStartDate ();
1268+ if ($ actualFirstHandoff < new DateTime ()) {
1269+ return '' ;
1270+ } else {
1271+ return sprintf (
1272+ $ this ->translate ('This would be %s in the chosen display timezone (%s) ' ),
1273+ (new \IntlDateFormatter (
1274+ \Locale::getDefault (),
1275+ \IntlDateFormatter::MEDIUM ,
1276+ \IntlDateFormatter::SHORT ,
1277+ $ this ->displayTimezone
1278+ ))->format ($ actualFirstHandoff ),
1279+ $ this ->displayTimezone ,
1280+ );
1281+ }
1282+ })
1283+ ));
1284+ }
12631285 }
12641286
12651287 $ this ->addElement ('submit ' , 'submit ' , [
0 commit comments