Issue Bug Closed

#102602Time input does not initialize 00:00 properly

Imko Schumacher 12/04/23, 19:47 updated 07/09/24, 15:12

Description

The time input does not properly load the time 00:00. When the field is required, it is marked as error after reloading the record.
This prevents a valid record to be saved.

Steps to reproduce

  1. Create record in the backend
  2. Set time to 00:00
    set-time-0000.png
  3. Save form

Results

  • Expected result: Input has the time 00:00
  • Actual result: the input is unset and the input field has an error (since required)
    time-after-save.png

TCA

    'columns' => [
        'mytime' => [
            'label' => 'mytime',
            'config' => [
                'type' => 'datetime',
                'format' => 'time',
                'default' => 0,
                'required' => true,
                'nullable' => false,
            ],
        ],
    ],

Cause

This bug was introduced in TYPO3 v12. In previous version, the time was set to 00:00.

It was introduced by the change https://review.typo3.org/c/Packages/TYPO3.CMS/+/79793

Possible fixes

This bug could be fixed in one of these places by removing the equals 0 checks
a) Form/Element/DatetimeElement) TypeScript/backend/form-engine-validation.ts

I think the better place is a), since all times are then returned as 1970-01-01T00:00:00Z. Whereas now, 0 is the exception.

Reviews 2