Review main Merged

88823[BUGFIX] Apply server timezone to datetime properties in record API

Benjamin Franzke CR +2 V +2 Hard +218 −73 updated 04/02/25, 10:38

Commit message

DateTime objects initialized with an @-prefix are forced to use UTC in
PHP. Since we require all dates to be initialized in localtime, we must
not instantiate DateTime from timestamps directly (see also #98045).

Instead we do now apply the same algorithm as already used by FormEngine
to transform database values to `\DateTime` instances. The logic is
extracted into a general purpose `DateTimeFactory`
The factory is intended to be rolled out in all places where database
values are converted into `\DateTime` representation.

Review

  • Code review CR +2 Done
    • Benjamin Franzke +2
    • Andreas Kienast +1
    • Benni Mack +1
  • Verified V +2 Done
    • Benjamin Franzke +2
    • Andreas Kienast +1
    • Benni Mack +1
    • core-ci +1 CI

Issues 2

Files 8

Review log 1825

  1. Benjamin Franzke uploaded patch set 1 03/28/25, 11:27

  2. core-ci voted on patch set 1 V -1 03/28/25, 11:40 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/76571

  3. Benjamin Franzke uploaded patch set 2 V -1 03/28/25, 11:58

  4. core-ci voted on patch set 2 V +1 03/28/25, 12:06 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/76576

  5. Benjamin Franzke uploaded patch set 3 V +1 03/28/25, 13:27

  6. core-ci voted on patch set 3 V +1 03/28/25, 13:36 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/76591

  7. Benjamin Franzke uploaded patch set 4 V +1 03/28/25, 15:30

  8. core-ci voted on patch set 4 V +1 03/28/25, 15:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/76599

  9. Benjamin Franzke marked it work in progress 03/29/25, 09:35

  10. Benjamin Franzke uploaded patch set 5 V +1 03/29/25, 12:55

  11. core-ci voted on patch set 5 V -1 03/29/25, 13:10 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/76635

  12. Benjamin Franzke uploaded patch set 6 V -1 03/29/25, 13:24

  13. core-ci voted on patch set 6 V +1 03/29/25, 13:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/76639

  14. Benjamin Franzke marked it ready for review 03/30/25, 18:54

  15. Benni Mack voted on patch set 6 CR +1 V +1 03/31/25, 15:32

  16. Andreas Kienast commented on patch set 6 04/01/25, 06:55

    DatabaseRowDateTimeFields.php:36

    This variable is now unused.

    DateTimeFactory.php:55

    This is bascially the same code as in `typo3/sysext/core/Classes/Schema/Field/DateTimeFieldType.php->getFormat()`. Should we consolidate this?
  17. Benjamin Franzke commented on patch set 6 04/01/25, 10:52

    DateTimeFactory.php:55 Reply

    Thought about this, but since `DateTimeFieldType` is the "new" API which is to constructed (only) inside the schema API, I didn't want to reuse that here. The other alternative would have been to call into `getFormatFromTCAConfig` from `DateTimeFieldType.php->getFormat`, but then again `Schema/Field/DateTimeFieldType` can not reuse it's persistenceType logic, and has to call into "legacy" API.
  18. Andreas Kienast commented on patch set 6 04/01/25, 10:57

    DateTimeFactory.php:55 Reply

    Acknowledged
  19. Benjamin Franzke uploaded patch set 7 CR +1 V +1 04/01/25, 10:59

  20. Benjamin Franzke commented on patch set 7 04/01/25, 10:59

    DatabaseRowDateTimeFields.php:36 Reply

    Thanks, done!
  21. core-ci voted on patch set 7 V +1 04/01/25, 11:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/76769

  22. Andreas Kienast voted on patch set 7 CR +1 V +1 04/02/25, 07:09

  23. Benni Mack voted on patch set 7 CR +1 V +1 04/02/25, 07:39

  24. Benjamin Franzke voted on patch set 7 CR +2 V +2 04/02/25, 08:16

  25. Benjamin Franzke merged patch set 8 04/02/25, 10:38