Issue Bug Closed

#106937TCA Datetime with different outputs depending on the “readonly” status

Thomas Rokohl 06/23/25, 18:28 updated 12/02/25, 14:27

Description

If you create a datetime entry in the TCA, you get different outputs depending on whether readonly = true or not.

If readonly is true the element render the date with php and add the timezone to the output.(in my case UTC+2)
If readonly is false, the element will display the date in a data attribute that contains the timestamp UTC+0.

Test TCA:

 [
  'exclude' => true,
  'label' => Test',
  'config' => [
    'type' => 'datetime',
    'default' => null,
    'size' => 30,
    'readOnly' => true,
    'dbType' => 'datetime',
    'nullable' => true,
  ],
],
'readOnly' => true, => 19:40
'readOnly' => false => 17:40

Reviews 3

History 58

  1. Benjamin Franzke commented and changed status New Accepted <span data-processor="relativetime" data-value="2025-06-23T20:17:09+00:00" > 06/23/25, 20:17 </span>

    Ack, confirm that this is still broken in TYPO3 v13.

    Note: TYPO3 main/v14 fixed this via https://review.typo3.org/c/Packages/TYPO3.CMS/+/86888

    (but) we need a fix for v13, because the readonly handling passes the fake UTC-0 string into the DateTime constructor, interpreting it as real UTC_0 instead of as fake UTC-0 (therefore local timezone offset is clamped).

    Relevant code is:
    https://github.com/TYPO3/typo3/blob/v13.4.14/typo3/sysext/backend/Classes/Form/Element/DatetimeElement.php#L109

  2. Gerrit Code Review pushed patch set 1 for 13.4 to change 89814 status Accepted Under Review <span data-processor="relativetime" data-value="2025-06-23T20:31:04+00:00" > 06/23/25, 20:31 </span>

  3. Thomas Rokohl commented <span data-processor="relativetime" data-value="2025-06-24T05:50:42+00:00" > 06/24/25, 05:50 </span>

    The patch works and solves the problem.

    Thank you.

  4. Benjamin Franzke commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2025-07-02T10:40:10+00:00" > 07/02/25, 10:40 </span>

    Applied in changeset commit:9675b92fd56fbc20cea0df146cb70a1022333d82.