Merge conflict Gerrit cannot merge this change. It needs a rebase onto main.

Review main Ready for review

95488[BUGFIX] Warn about endtime before starttime

Maike Kiebele CR +1 V +1 Expert +1312 −18 updated 11/10/26, 14:17

Commit message

A record whose endtime is at or before its starttime is never visible
in the frontend. Nothing said so: the record saved without complaint
and the editor was left to work out why the content never appeared.

FormEngine now shows an accessible hint below the end date field
on any table declaring both enable columns as datetime. Changing
either date re-evaluates the pair without blocking the save. The
check also works with a read-only start date. The bound is applied
by the new TcaDateTimeEnableColumnRange data provider, so there is
no new TCA option to configure.

DataHandler checks the stored record after a successful write and
logs a notice for the same state, for new as well as updated
records. This includes values changed by field post-processing
hooks. Rejected or failed writes do not produce this notice. The
backend renders it as a warning next to the record.

The record is still saved, so neither message may read as a failed
write. SysLog\Error::NOTICE is added to mark a log entry about an
operation that succeeded: it stays out of errorLog and out of the
erroneous records printLogErrorMessages() returns, so localizing,
copying or restoring such a record is no longer reported as failed,
and the notice is rendered without the "could not be completed"
wrapper.

Test this change

Run a command in your clone of the TYPO3 Core. Then try what the change does and vote on Verified in Gerrit. How to review a patch

Check out patch set 9
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/88/95488/9 && git checkout FETCH_HEAD
Cherry-pick onto main
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/88/95488/9 && git cherry-pick FETCH_HEAD

Review

  • Code review CR +1 Needs a vote
    • Christian Rath-Ulrich +1
    • Matthias Vogel +1
  • Verified V +1 Needs a vote
    • Christian Rath-Ulrich +1
    • Matthias Vogel +1
    • core-ci +1 CI

Issues 1

Files 21

Show 1 more file

Review log 2231

Show 46 earlier messages
  1. Maike Kiebele uploaded patch set 1 08/31/26, 11:41

  2. core-ci voted on patch set 1 V +1 08/31/26, 11:48 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/107421

  3. Benni Mack commented on patch set 1 08/31/26, 11:54

    DataHandler.php:1077

    Hi Maike, if we do this (= using Flash Message Service directly), this will become a problem on CLI. What we've done in the past is to log the message, and then printLogErrorMessages (to be called in the UI only) to render the flash messages. One other thing to note: Should we do this "validation" also in FormEngine while editing both dates?
  4. Maike Kiebele uploaded patch set 2 V +1 09/01/26, 12:14

  5. core-ci voted on patch set 2 V +1 09/01/26, 12:20 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/107486

  6. Benni Mack uploaded patch set 3 V +1 09/03/26, 23:44

  1. core-ci voted on patch set 3 V +1 09/03/26, 23:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/107787

  2. Benni Mack uploaded patch set 4 V +1 09/04/26, 09:50

  3. core-ci voted on patch set 4 V +1 09/04/26, 10:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/107849

  4. Georg Ringer voted on patch set 4 CR +1 V +1 09/04/26, 11:32

  5. Christian Rath-Ulrich uploaded patch set 5 CR +1 V +1 10/21/26, 18:30

  6. Christian Rath-Ulrich commented on patch set 5 V +1 10/21/26, 18:32

    rebesed and tested

    DataHandler.php:1077 Reply

    Done
  7. core-ci voted on patch set 5 V +1 10/21/26, 18:39 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/112032

  8. Oli Bartsch voted on patch set 5 V -1 10/21/26, 19:07

  9. Oli Bartsch commented on patch set 5 10/21/26, 19:22

    form-engine-validation.ts:78

    Only `isWithinFieldBoundary` is tested. I would like to see a test for `validateFieldsBoundedBy` too. And maybe even a functional test that copies and localizes a `tt_content` record with endtime < starttime asserting an empty `errorLog`, like the commit message claims.

    form-engine-validation.ts:301

    The range check sets `has-error`/`aria-invalid`, so `isValid()` fails and FormEngine refuses to save. This also affects existing records with endtime before starttime, even for unrelated edits. That contradicts the RST "never rejects". So either keep the block and fix the RST and commit message (including the note about existing records), or make the client-side check a non-blocking hint without `errorClass`.

    form-engine-validation.ts:385

    The editor never sees why endtime is invalid, and `aria-invalid` ends up on flatpickr's hidden input. Please mirror `aria-invalid` to `altInput` in `date-time-picker.ts` and add a field-level message (e.g. via `aria-describedby`).

    AbstractNode.php:166

    `range.lowerField`/`upperField` is effectively a new TCA option that any TCA can set. It is undocumented, and it is exclusive while `range.lower` is inclusive. Please keep it internal (a dedicated internal key, and drop the unused `upperField` branch), or document it as a main-only feature.

    AbstractNode.php:200

    THis is wrong inside FlexForms, because `FlexFormElementContainer` passes the parent's data on unchanged. The docblock is therefore incorrect too. Please make it `private` and return `''` inside a FlexForm (or derive the name from `elementBaseName`/`itemFormElName`) and adjust the docblock.

    DataHandler.php:1092

    In workspaces, `$id` points to the version record, but the fallback values (the date not submitted, the title) come from the live `$currentRecord`. A partial datamap changing only endtime is then compared against the live starttime. Please read the fallbacks from the version row and add a functional workspace test.

    Important-109139-WarnWhenEndtimeIsBeforeStarttime.rst:1

    the file belongs in `Changelog/14.3.x/`
  10. Christian Rath-Ulrich uploaded patch set 6 V +1 10/22/26, 08:49

  11. core-ci voted on patch set 6 V +1 10/22/26, 08:59 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/112078

  12. Christian Rath-Ulrich commented on patch set 6 10/22/26, 09:02

    form-engine-validation.ts:78 Reply

    Done. validateFieldsBoundedBy is covered for an end date before the start date, equal to it, after it, and empty. The bounded field in that test has no name, only data-formengine-input-name, as the datetime element does. TimeRestrictionConsistencyTest::copyAndLocalizeKeepAnEmptyErrorLog creates a tt_content record with endtime before starttime, copies it and localizes it, and asserts an empty errorLog both times.

    form-engine-validation.ts:301 Reply

    Taken the second option. The sibling check no longer sets has-error, so isValid() stays true and FormEngine still saves. That includes an existing record that already ends before it starts, and an edit that does not touch the two dates. aria-invalid is still set, together with the hint from #385. The changelog now says the same. One sentence in the commit message still says the field is marked invalid. That sentence needs to be aligned on the next amend.

    form-engine-validation.ts:385 Reply

    Done. The end date field gets a visible hint, "The end date is at or before the start date, so this record will never be visible.", linked with aria-describedby. date-time-picker.ts copies aria-invalid, aria-describedby and has-error from the hidden input onto altInput, once when the picker is ready and again on t3-formengine-postfieldvalidation.

    AbstractNode.php:166 Reply

    Kept internal. TcaDateTimeEnableColumnRange writes enablecolumnsRangeLowerField on the field config, outside config.range. range.lowerField is ignored, and the upperField branch is gone. The comparison stays exclusive, unlike the inclusive range.lower and range.upper. There is no new TCA option.

    AbstractNode.php:200 Reply

    getFormElementNameForSiblingField() is private and returns an empty string when flexFormFieldName or flexFormContainerFieldName is set, because the parent table, uid and columns are not the FlexForm siblings. The docblock says so. The sibling name is not derived from elementBaseName.

    DataHandler.php:1092 Reply

    Done. When the incoming id is the live uid and the write goes to a workspace version, the date that was not submitted and the title are read from that version row (getRecord() with the delete clause disabled). TimeRestrictionConsistencyWorkspaceTest covers both directions: a partial endtime change compared with a later version starttime logs one notice titled with the version record, and a partial change compared with an earlier version starttime logs none.

    Important-109139-WarnWhenEndtimeIsBeforeStarttime.rst:1 Reply

    Done
  13. Matthias Vogel uploaded patch set 7 V +1 10/22/26, 16:20

    Use the standard error styling for the end date hint and keep it compact below the field. Keep the hint accessible and non-blocking, including when the start date is read-only. Log DataHandler notices after successful writes using the stored record. Respect values changed by field post-processing hooks and avoid notices for rejected or failed updates. Add regression coverage for read-only and empty boundary values, rejected updates, hook-adjusted dates and database errors. Align the commit message with the final behavior. Rebased onto current main. Validation: 254 PHP unit tests, 31 functional tests and all 344 JavaScript tests passed. The full frontend build, TypeScript, ESLint, CGL, PHP integrity and RST checks also passed.
  14. core-ci voted on patch set 7 V +1 10/22/26, 16:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/112147

  15. Matthias Vogel voted on patch set 7 CR +1 V +1 10/22/26, 16:34

  16. Simon Schaufelberger commented on patch set 7 CR -1 10/22/26, 18:51

    please rebase and resolve the merge conflict
  17. Matthias Vogel uploaded patch set 8 CR +1 V +1 10/23/26, 09:45

  18. Matthias Vogel voted on patch set 8 CR +1 V +1 10/23/26, 09:52

  19. core-ci voted on patch set 8 V -1 10/23/26, 10:48 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/112259

  20. Matthias Vogel rebased onto patch set 9 CR +1 V +1 10/23/26, 10:50

  21. Matthias Vogel voted on patch set 9 CR +1 V +1 10/23/26, 10:51

  22. core-ci voted on patch set 9 V +1 10/23/26, 11:08 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/112275

  23. Christian Rath-Ulrich voted on patch set 9 CR +1 V +1 10/23/26, 19:05

  24. Oli Bartsch commented on patch set 9 11/10/26, 13:39

    To me, this patch is far to big for a bugfix, to be backported to v14. Additionally I wonder if instead of adding this special handling into FormEngine, we should better use a new dedicated form field (element) for start/endtime?
  25. Markus Klein commented on patch set 9 11/10/26, 14:17

    Reply Unresolved

    I'd even put this up one level and would see this as a feature that extensions may need as well. There are also fields depending on each other: Example an event's begin and end date. So maybe even widen the use-case?