Bug #106364
openEpic #77562: Misbehaviors with datetime values and timezones
DatetimeElement stores format=time in seconds, while extbase interprets it as timezone-offset-mapped UTC timestamp, when php timezone is not UTC
0%
Description
When configuring a field TCA as:
'config' => [ 'type' => 'datetime', 'format' => 'time', ],
And the field is stores as int timestamp in the Database.
And the Timezone in PHP is not set to UTC.
Then the time is stored in the timezone configured in PHP and not in UTC.
This behavior differs from when using format datetime (default) in the TCA configuration, and leads to errors i.e. when outputting the time in fluid with f:format.date.
/sysext/backend/Classes/Form/Element/DatetimeElement.php
For a date in "datetime" format there is applied a "Fake UTC-0" normalization to the items value.
This normalization is not applied, when the field is in format "time". But should.
Edit: Extbase interprets format=time differently, see https://forge.typo3.org/issues/106364#note-5
When i now reopen the entity in the list module both fields still show 9:30. But when loading the fields as DateTime object via an Extbase model, then the starttime is 8:30 UTC and the endtime is 9:30 UTC.
Files