Project

General

Profile

Actions

Bug #106364

open

Epic #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

Added by Mogens Fiebrandt 3 days ago. Updated about 18 hours ago.

Status:
Under Review
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
Start date:
2025-03-12
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
13
PHP Version:
8.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

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

clipboard-202503140019-kp0sk.png (2.52 KB) clipboard-202503140019-kp0sk.png Mogens Fiebrandt, 2025-03-13 23:19
clipboard-202503140024-27b4z.png (9.47 KB) clipboard-202503140024-27b4z.png Mogens Fiebrandt, 2025-03-13 23:24
clipboard-202503140034-bxqhd.png (9.58 KB) clipboard-202503140034-bxqhd.png Mogens Fiebrandt, 2025-03-13 23:34
clipboard-202503140046-p3otj.png (51 KB) clipboard-202503140046-p3otj.png Mogens Fiebrandt, 2025-03-13 23:46

Related issues 3 (1 open2 closed)

Related to TYPO3 Core - Feature #105549: Replace fake UTC0 ISO8601 date strings by unqualified (local) ISO8601Under Review2024-11-06

Actions
Related to TYPO3 Core - Task #104309: Use ISO dates in FormEngine date handlingClosed2024-07-04

Actions
Related to TYPO3 Core - Task #103496: Use ISO date format by defaultClosedMathias Brodala2024-03-28

Actions
Actions

Also available in: Atom PDF