Review 10.4 Abandoned

70167[BUGFIX] Prevent bootstrap datetimepicker from changing values

Nikita Hovratov CR 0 V 0 Easy +23 −9 updated 04/04/22, 18:07

Commit message

The bootstrap datetime picker uses the current client time for
validation, regardless of the field's input value. If minDate lies in
the future, the validation always fails and resets to the minDate value.

As invalid values should never be changed automatically (on the client
side), we add the option "keepInvalid" to the bootstrap datetimepicker
configuration.

Additional fixes:
- The FormEngineValidation was missing the ability to compare range
values of dates. The validateField method now checks for a
DateTimePicker instance and converts the date to a unix timestamp.

- Date fields were initialized multiple times, because the check for
already initialized fields did not work. The reason for this was, that
the datepicker is loaded asynchronously. A dummy DateTimePicker
instance is added, so the check works correctly.

- The min and max date formatting in DateTimePicker.js didn't work for
quite some time, because of changed data attributes in #83240 (834f936).
Besides that, they also weren't needed since that, as it is already
set in the InputDateTimeElement.

Review

  • Code review CR 0
  • Verified V 0

Issues 3

Files 3

Review log 1321

  1. Nikita Hovratov uploaded patch set 1 07/30/21, 19:12

  2. core-ci voted on patch set 1 V -1 07/30/21, 19:21 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/13930

  3. Nikita Hovratov uploaded patch set 2 07/30/21, 20:24

  4. core-ci voted on patch set 2 V +1 07/30/21, 20:35 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/13932

  5. Nikita Hovratov commented on patch set 2 07/30/21, 20:40

    Probably also backport to v9, but didn't test it yet.
  6. Nikita Hovratov uploaded patch set 3 07/31/21, 08:20

  7. core-ci voted on patch set 3 V +1 07/31/21, 08:26 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/13943

  8. Nikita Hovratov uploaded patch set 4 07/31/21, 08:39

  9. core-ci voted on patch set 4 V +1 07/31/21, 08:49 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/13944

  10. Nikita Hovratov updated the commit message in patch set 5 08/01/21, 12:10

  11. core-ci voted on patch set 5 V +1 08/01/21, 12:21 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/13962

  12. Nikita Hovratov rebased onto patch set 6 08/16/21, 17:33

  13. core-ci voted on patch set 6 V +1 08/16/21, 17:54 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15204

  14. Benni Mack updated the commit message in patch set 7 10/14/21, 12:04

  15. core-ci voted on patch set 7 V +1 10/14/21, 12:26 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/18101

  16. Benni Mack commented on patch set 7 11/11/21, 08:35

    isn't DateTimePicker also used for things outside of FormEngine?
  17. Nikita Hovratov commented on patch set 7 11/11/21, 09:14

    Reply

    You mean for filtering stuff? Yeah, but it shouldn't be affected by this. Better to check it too of course.
  18. Nikita Hovratov rebased onto patch set 8 12/03/21, 19:11

  19. core-ci voted on patch set 8 V +1 12/03/21, 19:23 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/20533

  20. Benjamin Franzke commented on patch set 8 01/10/22, 20:05

    Reply Unresolved

    It is used in `belog`. Usually element.dispatchEvent(new Event('change')) can be used instead of FormEngineValidation.validateField (there is an event handler that calls validateField when FormEngine is running). But the question is: Why exactly is FormEngineValidation.validateField needed during initialization? (triggered `change` without a change will of course look strange)
  21. Nikita Hovratov abandoned the change 04/04/22, 18:07

    No chance this will get merged in v10 anymore