Review main Merged

92996[FEATURE] Add DateEditor web component for ext:form

Josua Vogel CR +2 V +2 Hard +627 −143 updated 03/05/26, 13:09

Commit message

Introduce a web component <typo3-form-date-editor>
that provides a structured UI for date constraints and default values
of Date form elements in the form editor backend.

The editor supports four modes:
- No limit: Clears the value
- Today: Sets the value to "today"
- Absolute date: Native HTML5 date picker
- Relative date: Direction, amount and unit selects producing
  expressions like "-18 years" or "+1 month"
- Custom relative expression

The DateRange validator minimum/maximum fields and the Date
element default value now use the new editor instead of a plain
text input.

Review

  • Code review CR +2 Done
    • Georg Ringer +2
    • Garvin Hicking +1
  • Verified V +2 Done
    • Georg Ringer +2
    • Garvin Hicking +1
    • core-ci +1 CI

Issues 1

Files 18

Review log 4360

Show 2535 earlier messages
  1. Josua Vogel uploaded patch set 1 02/25/26, 15:01

  2. Josua Vogel updated the commit message in patch set 2 02/25/26, 15:03

  3. Josua Vogel uploaded patch set 3 02/25/26, 15:13

  4. core-ci voted on patch set 3 V -1 02/25/26, 15:25 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96833

  5. core-ci voted on patch set 1 V -1 02/25/26, 15:41 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96830

  6. core-ci voted on patch set 2 V -1 02/25/26, 15:47 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96832

  7. Josua Vogel rebased onto patch set 4 V -1 03/02/26, 13:42

  8. core-ci voted on patch set 4 V -1 03/02/26, 14:19 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97111

  9. Josua Vogel uploaded patch set 5 V -1 03/02/26, 16:34

  10. core-ci voted on patch set 5 V -1 03/02/26, 17:12 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97127

  11. Josua Vogel uploaded patch set 6 V -1 03/03/26, 06:07

  12. core-ci voted on patch set 6 V -1 03/03/26, 06:16 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97153

  13. Josua Vogel uploaded patch set 7 V -1 03/03/26, 08:41

  14. core-ci voted on patch set 7 V +1 03/03/26, 08:55 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97160

  15. Simon Schaufelberger commented on patch set 7 03/03/26, 09:02

    DateEditor.fluid.html:1

    The fluid annotation is missing to ignore the html Tag
  16. Josua Vogel uploaded patch set 8 V +1 03/03/26, 09:06

  17. Josua Vogel commented on patch set 8 03/03/26, 09:06

    DateEditor.fluid.html:1 Reply

    Done
  18. core-ci voted on patch set 8 V +1 03/03/26, 09:16 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97164

  19. Garvin Hicking commented on patch set 8 V +1 03/04/26, 08:21

    locallang_relative_date_editor.xlf:19

    This wraps unfortunately for me to "in the f..." and "in the p..." I wonder if we should just use "past" and "future" here? I really like the dense display otherwise. Another way would be to change the top level dropdown to: - No value - Today - Absolute day - Relative date in the future - Relative date in the past I reckon that would be a huge structural change though. So shortening the label is maybe better....wdyt?
  20. Josua Vogel commented on patch set 8 03/04/26, 08:25

    locallang_relative_date_editor.xlf:19 Reply

    I´m fine with shorter label. Thought about + and -, but I think, that´s not user friendly :)
  21. Josua Vogel uploaded patch set 9 V +1 03/04/26, 08:29

  22. Josua Vogel commented on patch set 9 03/04/26, 08:29

    locallang_relative_date_editor.xlf:19 Reply

    Done
  23. Garvin Hicking voted on patch set 9 CR +1 V +1 03/04/26, 08:43

  24. core-ci voted on patch set 9 V +1 03/04/26, 08:44 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97270

  25. Georg Ringer commented on patch set 9 V -1 03/04/26, 08:44

    I am not sure if we should split that up in week/month, something like "1 week 6 days" is not possible then anymore and yes this can be really handy. I would keep the input field
  26. Anja Leichsenring voted on patch set 9 CR +1 V +1 03/04/26, 08:52

  27. Josua Vogel commented on patch set 9 03/04/26, 08:56

    Reply

    Good point – I thought about this as well. However, I'm not sure if "1 week and 6 days" is really a practical use case for relative dates. At that point, wouldn't a fixed/absolute date be more appropriate? Additionally, the user could simply enter "13 days" instead, which achieves the same result. IMO the input field is not user friendly - I know many editors who don´t know the php wordings.
  28. Anja Leichsenring commented on patch set 9 03/04/26, 08:57

    Reply

    maybe add another option "manual input" that brings the input field back? While I would argue that some little math solves that problem easily enough: 13 days in the future, is it not?
  29. Sven Liebert voted on patch set 9 CR +1 V +1 03/04/26, 09:07

  30. Josua Vogel uploaded patch set 10 CR +1 V +1 03/04/26, 09:11

  31. Josua Vogel commented on patch set 10 03/04/26, 09:12

    Resolved merge conflict
  32. Sven Liebert voted on patch set 10 CR +1 V +1 03/04/26, 09:17

  33. core-ci voted on patch set 10 V +1 03/04/26, 09:27 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97282

  34. Anja Leichsenring commented on patch set 10 V -1 03/04/26, 09:50

    repeating Georgs sentiment. Please lets discuss this first.
  35. Garvin Hicking commented on patch set 10 03/04/26, 12:58

    Reply

    This breaks apart for "1 months and 3 days". Because then you can't math it. I think adjusting the dropdown to contain a "manual relative date" would solve this, and hopefully not be too complex.
  1. Josua Vogel commented on patch set 10 03/04/26, 13:12

    Reply

    I'm not fundamentally opposed to it, but is it perhaps too far-fetched/overengineered? I simply can't think of any use case where you would need to set such a relative value. Every use case I can think of in this regard has to do with an absolute date. Is there really anything where you need a maximum/minimum in 1 month and three days every day? Theoretically, a developer could also create a custom editor for this use case or simply integrate the text editor again.
  2. Garvin Hicking commented on patch set 10 03/04/26, 13:54

    Reply

    What about "last Monday" or "next Sunday" then, would that sound like a more plausible use case? :)
  3. Josua Vogel commented on patch set 10 03/04/26, 14:11

    Reply

    Fair point 😄
  4. Josua Vogel uploaded patch set 11 CR +1 V +1 03/04/26, 14:30

  5. Josua Vogel commented on patch set 11 03/04/26, 14:30

    Reply

    Done
  6. core-ci voted on patch set 11 V +1 03/04/26, 14:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97332

  7. Garvin Hicking commented on patch set 11 03/04/26, 15:42

    Reply

    The validation currently does not allow me to enter "last sunday" and "first sunday next month" as relative dates, probably because it's locked by the "+1" and day/month/year usage. Also I'm recognizing now that `DateRangeValidatorPatterns` and its regexp might be too strict. Couldn't we have "relative date" then defined as "anything that does not match RFC3339_FULL_DATE? Then we could check for strtotime === false if anything has been entered that does not match. Handling it clientside for JavaScript maybe we can switch to not displaying an error like "Invalid relative date expression" but instead something like "This may not be a valid relative date expression, please verify your input works" if the regexp is not satisfied. But then not block entering them?

    locallang_relative_date_editor.xlf:40

    ```suggestion <source>e.g. "sunday next month"</source> ```
  8. Josua Vogel commented on patch set 12 V +1 03/04/26, 15:45

    Published edit on patch set 11.
  9. Josua Vogel commented on patch set 12 03/04/26, 15:49

    locallang_relative_date_editor.xlf:40 Reply

    Fix applied.
  10. core-ci voted on patch set 12 V +1 03/04/26, 16:26 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97341

  11. Josua Vogel uploaded patch set 13 V +1 03/04/26, 16:58

  12. core-ci voted on patch set 13 V -1 03/04/26, 17:15 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97348

  13. Josua Vogel uploaded patch set 14 V -1 03/05/26, 06:24

  14. Josua Vogel commented on patch set 14 03/05/26, 06:29

    Reply

    please try again 😊
  15. core-ci voted on patch set 14 V +1 03/05/26, 06:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97386

  16. Josua Vogel commented on patch set 15 V +1 03/05/26, 07:40

    Published edit on patch set 14.
  17. core-ci voted on patch set 15 V +1 03/05/26, 07:49 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97389

  18. Garvin Hicking commented on patch set 15 03/05/26, 09:48

    Reply

    This is pretty nice for me now, we're getting close. One thing: If I enter an invalid expression like "your mom" into a date max/min element it is passed on to the HTML `<input>` element. This is then silently ignored, that's fine. However, if I submit this I get: ``` (1/1) #1521293814 TYPO3\CMS\Form\Mvc\Validation\Exception\InvalidValidationOptionsException The option "maximum" (hörker pörk!) could not be converted to DateTime. Use format "Y-m-d" or a relative expression (e.g. "today", "-18 years"). ``` now I wonder if this exception should be end-user facing. Two ideas: Either could we somehow "simulate" in the EXT:form GUI to perform a PHP strtotime() conversion here and report errors in the GUI of the backend? Probably hard to execute PHP in there (we'd have to setup an ajax route?!) The other idea: Instead of exceptioning there, we create a better abstragt validation error for the field like "Technical implementation error, the field could not be validated. This error has been logged". And then, we would also need to log this error instead of throwing. wdyt?
  19. Josua Vogel commented on patch set 15 03/05/26, 10:33

    Reply

    I like the second idea. It solves the problem and does not require a complex change, such as an Ajax route.
  20. Josua Vogel uploaded patch set 16 V +1 03/05/26, 10:45

  21. core-ci voted on patch set 16 V -1 03/05/26, 10:58 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97403

  22. core-ci voted on patch set 16 V +1 03/05/26, 12:17 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97403

  23. Garvin Hicking commented on patch set 16 CR +1 V +1 03/05/26, 12:37

    Reply

    I'm good with that. Thanks! 😊
  24. Georg Ringer voted on patch set 16 CR +2 V +2 03/05/26, 13:09

  25. Georg Ringer merged patch set 17 03/05/26, 13:09