Review main Merged

86730[BUGFIX] Validate date ranges correctly

Andreas Kienast CR +2 V +2 Normal +48 −10 updated 10/30/24, 11:56

Commit message

With the changes done in #104309, FormEngine works with `Date` objects
and not with timestamps anymore. This unfortunately broke the validation
in cases `lower` and/or `upper` ranges are defined as the values still
were treated as timestamps.

The code branches in the validation now have a separate check for input
fields of type `datetimepicker` and treat the comparison differently
and works with ISO8601 for the value and for the upper/lower range
values.

Review

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

Issues 2

Files 4

Review log 2230

Show 35 earlier messages
  1. Andreas Kienast uploaded patch set 1 10/24/24, 08:08

  2. core-ci voted on patch set 1 V +1 10/24/24, 08:13 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/68512

  3. Andreas Kienast uploaded patch set 2 V +1 10/24/24, 08:21

  4. core-ci voted on patch set 2 V +1 10/24/24, 08:26 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/68513

  5. Andreas Kienast uploaded patch set 3 V +1 10/24/24, 08:35

  1. core-ci voted on patch set 3 V +1 10/24/24, 08:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/68514

  2. Garvin Hicking voted on patch set 3 CR +1 V +1 10/24/24, 08:51

  3. Benjamin Franzke commented on patch set 3 CR -1 10/25/24, 05:50

    form-engine-validation.ts:265

    This is *probably* right, but I just want to mention I need to wrap my head around this (again), to ensure we're fine regarding timezone offsets here.. Our hack in date-time-picker.ts makes me a bit sceptical: ``` formatDate: (date: Date, format: string) => { const dt = DateTime.fromJSDate(date); if (format === ISO8601_UTC) { // JS dates are always encoded in localtime (flatpickr can only operate in localtime) and are now "intepreted" as UTC: // We discard the intermediate local-time offset; that means the hours and minutes from localtime are rendered as-is return dt.toUTC().plus(dt.offset * 60 * 1000).toISO({ suppressMilliseconds: true }); } return dt.toFormat(format); }, ``` That means this *could be wrong* because `dt` weould be the localtime interpreted as UTC, and thus the server's localtime timezone offset would be ignored.
  4. Benjamin Franzke commented on patch set 3 10/29/24, 13:59

    form-engine-validation.ts:265 Reply

    Verified this to be incorrect if the server is not using UTC. Example: Server timezone: Europe/Berlin (/etc/php.ini `timezone=Europe/Berlin`) Column: tx_styleguide_elements_basic.inputdatetime_34 Minimum timestamp: 1627208536 UTC: So 25. Jul 10:22:16 UTC 2021 Localtime min: So 25. Jul 12:22:16 CEST 2021 That means the user should not be allowed to set an hour earlier than `12:22` of the 25th of july 2021 for a server with timezone `Europe/Berlin`. But a user can enter anything >10:22, because the validation assumes that the server is using UTC, and therefore does not respect the UTC+2 offset of the timezone at that date.
  5. Benjamin Franzke uploaded patch set 4 CR +1 V +1 10/29/24, 16:05

  6. Benjamin Franzke commented on patch set 4 10/29/24, 16:05

    form-engine-validation.ts:265 Reply

    Done
  7. Benjamin Franzke voted on patch set 4 CR +1 V +1 10/29/24, 16:06

  8. core-ci voted on patch set 4 V +1 10/29/24, 16:13 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/68797

  9. Garvin Hicking commented on patch set 4 10/29/24, 16:23

    AbstractNode.php:156

    Would this one need a (int) casting like in https://review.typo3.org/c/Packages/TYPO3.CMS/+/86701/2..3, too? (same with 'upper' below 'lower')
  10. Benjamin Franzke uploaded patch set 5 CR +1 V +1 10/29/24, 17:23

  11. Benjamin Franzke commented on patch set 5 10/29/24, 17:23

    AbstractNode.php:156 Reply

    I don't think so (also not in the other case), but let's do so (for consistency and safety)
  12. Benjamin Franzke voted on patch set 5 CR +1 V +1 10/29/24, 17:23

  13. core-ci voted on patch set 5 V +1 10/29/24, 17:30 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/68799

  14. Andreas Kienast uploaded patch set 6 CR +1 V +1 10/30/24, 09:00

  15. core-ci voted on patch set 6 V +1 10/30/24, 09:08 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/68832

  16. Benjamin Franzke commented on patch set 6 CR +1 V +1 10/30/24, 09:16

    To be used together with 86701: [BUGFIX] Use correct dataset identifier for date ranges | https://review.typo3.org/c/Packages/TYPO3.CMS/+/86701
  17. Andreas Kienast commented on patch set 6 10/30/24, 09:26

    ALARM :P

    form-engine-validation.ts:283

    upper
  18. Andreas Kienast commented on patch set 7 CR +1 V +1 10/30/24, 09:27

    Published edit on patch set 6.
  19. Andreas Kienast commented on patch set 7 10/30/24, 09:27

    form-engine-validation.ts:283 Reply

    Done
  20. Andreas Kienast uploaded patch set 8 10/30/24, 09:30

  21. core-ci voted on patch set 7 V +1 10/30/24, 09:33 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/68835

  22. core-ci voted on patch set 8 V +1 10/30/24, 09:37 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/68836

  23. Garvin Hicking voted on patch set 8 CR +1 V +1 10/30/24, 09:39

  24. Benjamin Franzke voted on patch set 8 CR +2 V +2 10/30/24, 11:44

  25. Benjamin Franzke merged patch set 9 10/30/24, 11:56