Issue Bug Closed

#105550(pseudo) Native dbType=datetime strings in flexforms not working and interpreted as integer

Benjamin Franzke 11/06/24, 15:29 updated 08/12/25, 14:35

Description

With dbType=datetime in a flexform:

https://github.com/TYPO3/typo3/blob/3343d780e6438a8de02494717fb5761e461f65b9/typo3/sysext/styleguide/Configuration/TCA/tx_styleguide_elements_basic.php#L1703-L1710

<inputDateTime_4>
    <label>inputDateTime_4 dbType=datetime format=date</label>
    <config>
        <type>datetime</type>
        <format>date</format>
        <dbType>datetime</dbType>
    </config>
</inputDateTime_4>

The value is interpreted as integer instead of as a string because the DatabaseRowDateTimeFields is only applied to real columns and not to flexform columns.

Which then results in flexform dbType datetime’s to be interpreted as integers by:
https://github.com/TYPO3/typo3/blob/3343d780e6438a8de02494717fb5761e461f65b9/Build/Sources/TypeScript/backend/form-engine-validation.ts#L156

Therefore a database value like 1960-01-01 05:42:23 is interpreted as 1960 seconds (unix timestamp) which results in a fake-date to be calculated: 1970-01-01T00:32:40Z (32:40 because 1960 = 32 * 60 + 40)

As a result the date is 1970 instead of 1960 as shown below:
flex-dbtype-datetime-parsed-as-integer-timestamp.png

Reviews 3