[BUGFIX] Fix initialization of 00:00 time input
The value of the `time` input is sent as an ISO date to the FormEngine, except for the time "00:00", which is just submitted as "0". This has lead to the input field not getting populated by the JavaScript initialization, and the input "00:00" was lost. In cases where such a `time` input is set as a required field, the validation would then fail because of the field getting interpreted as being empty/unset. With this patch, a "0" value is also interpreted as a valid "1970-01-01T00:00:00+00:00" string, that is parseable by FormEngine. Note this only affects display within the FormEngine; the format of the stored data is not changed (converted by DataHandler to proper values and covered by existing tests). IMPORTANT: This only applies to NULLABLE time|timesec inputs. Only for this configuration it is possible to decide, that a stored "0" value in the database is actually "00:00" and not an unset entry. Integrators/developers need to set 'nullable' TCA key to 'true' of the corresponding 'config' array, in case they want to make a time/timesec input picker be able to store and retrieve "00:00" as a valid timestamp. Resolves: #102602 Releases: main, 12.4 Change-Id: Id5dae6564a5da9ab3abd99bdc14b718cc7064464 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82093 Tested-by:core-ci <typo3@b13.com> Tested-by:
Benjamin Franzke <ben@bnf.dev> Reviewed-by:
Garvin Hicking <gh@faktor-e.de> Tested-by:
Garvin Hicking <gh@faktor-e.de> Reviewed-by:
Benjamin Franzke <ben@bnf.dev>
Showing
- typo3/sysext/backend/Classes/Form/Element/DatetimeElement.php 15 additions, 4 deletions...3/sysext/backend/Classes/Form/Element/DatetimeElement.php
- typo3/sysext/backend/Tests/Unit/Form/Element/DatetimeElementTest.php 158 additions, 0 deletions...t/backend/Tests/Unit/Form/Element/DatetimeElementTest.php
Please register or sign in to comment