11 $ui = $DIC->ui()->factory();
13 $renderer = $DIC->ui()->renderer();
14 $request = $DIC->http()->request();
18 $date = $ui->input()->field()->dateTime(
"Pick a date/time",
"This is the byline text");
21 ->withFormat(
$data->dateFormat()->germanShort());
22 $time = $date->withTimeOnly(
true);
23 $both = $date->withUseTime(
true);
27 $timezoned = $both->withTimezone(
$tz)->withByline(
'Result-value will have TZ ' .
$tz);
31 $date_zoned =
new DateTime(
'now',
new \DateTimeZone(
$tz));
35 $format = $timezoned->getFormat()->toString() .
' H:i';
36 $timezoned_preset1 = $timezoned->withValue($date_now->format(
$format))
37 ->withByline(
'This is local "now"');
38 $timezoned_preset2 = $timezoned->withValue($date_zoned->format(
$format))
39 ->withByline(
'This is "now" in ' .
$tz);
42 $form = $ui->input()->container()->form()->standard(
'#', [
44 'formatted' => $formatted,
47 'timezoned' => $timezoned,
48 'timezoned_preset1' => $timezoned_preset1,
49 'timezoned_preset2' => $timezoned_preset2,
51 ->withValue($date_now->format(
$format))
52 ->withLabel(
'disabled')
57 if ($request->getMethod() ==
"POST") {
58 $form = $form->withRequest($request);
66 "<pre>" . print_r(
$result,
true) .
"</pre><br/>" .
67 $renderer->render($form);