Review main Merged

92776[TASK] Add datetime web component and backend date format service

Benjamin Kott CR +2 V +2 Hard +944 −37 updated 02/16/26, 17:00

Commit message

This introduces a new `<typo3-backend-datetime>` web component that
provides consistent and accessible timestamp rendering throughout the
TYPO3 backend. The component accepts timestamps in multiple formats
including ISO 8601 strings and Unix timestamps (seconds) and
intelligently handles their conversion and display.

The component supports two display modes: absolute format using TYPO3's
configured date and time formats, and relative format that displays
human readable time differences such as "2 minutes ago". For relative
timestamps, the component features adaptive auto-update intervals that
adjust based on how old the timestamp is. This prevents unnecessary
updates while keeping displays current without requiring page refreshes.

To ensure full accessibility compliance with WCAG 2.1 AA standards, the
component uses semantic `<time>` elements with ISO 8601 datetime
attributes (SC 1.3.1). The implementation deliberately omits aria-live
attributes to prevent announcement fatigue when multiple timestamp
instances are present on a page (SC 4.1.3).

Additional features include configurable threshold-based fallback from
relative to absolute display for older dates, custom date format strings
using Luxon syntax, and automatic locale detection from the document
language settings.

Review

  • Code review CR +2 Done
    • Benjamin Kott +2
    • Benjamin Franzke +1
    • Oli Bartsch +1
  • Verified V +2 Done
    • Benjamin Kott +2
    • Benjamin Franzke +1
    • Oli Bartsch +1
    • core-ci +1 CI

Issues 1

Files 19

Review log 3042

Show 1217 earlier messages
  1. Benjamin Kott uploaded patch set 1 02/10/26, 11:59

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

  3. Benjamin Kott uploaded patch set 2 V -1 02/10/26, 13:29

  4. Benjamin Kott updated the commit message in patch set 3 02/10/26, 13:32

  5. core-ci voted on patch set 2 V -1 02/10/26, 13:39 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95546

  6. core-ci voted on patch set 3 V -1 02/10/26, 13:42 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95547

  7. Benjamin Kott uploaded patch set 4 V -1 02/10/26, 13:58

  8. core-ci voted on patch set 4 V +1 02/10/26, 14:06 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95551

  9. Georg Ringer commented on patch set 4 02/10/26, 17:13

    do we trap into NIH? can't we use https://www.webcomponents.org/element/time-elements ?
  10. Garvin Hicking commented on patch set 4 02/10/26, 18:28

    Reply

    I would argue due to the "live updating" it's worthwhile to have? Also I think this referred time element is missing the arria attributions plus tooltip output of absolute date in relative mode?
  11. Benjamin Kott commented on patch set 4 02/10/26, 18:29

    Reply

    it does something different, this one is adapting to our date formats, handles our wrong locales for zh (ch), has refresh if needed and is only a simple wrapper around luxon that we already use in other places.
  12. Benjamin Kott commented on patch set 4 02/10/26, 18:35

    Reply

    in addition i would really like to avoid collecting elements from here and there, we should cover them ourselfs if there is nothing in the native browser spec and we should try to remove again what we can and only preserve slim wrappers
  13. Georg Ringer commented on patch set 4 02/10/26, 19:56

    Reply

    just asking questions, using something which is maintained by github and got 4k stars is not a "here-and-there" component.
  14. Benjamin Kott rebased onto patch set 5 V +1 02/11/26, 13:48

  15. core-ci voted on patch set 5 V +1 02/11/26, 13:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95620

  16. Oliver Hader commented on patch set 5 02/12/26, 09:08

    Reply

    There are also a bunch of aspects that have not been addressed by Google (https://github.com/github/relative-time-element/issues). Having our own `<typo3-backend-datetime>` element gives us more flexibility here (updates, centralized datetime formats, styling & aria, ...)
  17. Georg Ringer voted on patch set 5 CR +1 V +1 02/12/26, 11:15

  1. Benjamin Kott commented on patch set 5 CR -1 02/12/26, 13:20

    on it
  2. Benjamin Kott uploaded patch set 6 CR +1 V +1 02/12/26, 13:43

  3. Benjamin Kott uploaded patch set 7 02/12/26, 13:44

  4. Benjamin Kott uploaded patch set 8 02/12/26, 13:59

  5. core-ci voted on patch set 8 V +1 02/12/26, 14:22 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95742

  6. core-ci voted on patch set 6 V -1 02/12/26, 14:31 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95736

  7. core-ci voted on patch set 7 V +1 02/12/26, 14:33 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95737

  8. Oli Bartsch commented on patch set 8 02/12/26, 16:32

    DateFormatConfigurationService.php:29

    This reads more like a factory then a service?

    DateFormats.php:25

    Why is this plural?

    PageRenderer.php:983

    This looks like a hack. I would like to avoid this. It's a public method in a non @internal class. Side effects can not be ruled out here.
  9. Benjamin Kott commented on patch set 8 02/12/26, 21:14

    PageRenderer.php:983 Reply

    the behavior was present before but with empty string, just made it clear and used null instead
  10. Benjamin Kott uploaded patch set 9 V +1 02/12/26, 22:59

  11. Benjamin Kott commented on patch set 9 02/12/26, 23:02

    DateFormatConfigurationService.php:29 Reply

    i agree here, but i also renamed it to DateConfigurationFactory, with the DateConfiguration Matching now. this made more sense the more i looked at it. it's simply more than just format configuration

    DateFormats.php:25 Reply

    It´s a collection of formats, its never a single format. its a wrapper that holds more than one format.
  12. Benjamin Kott commented on patch set 9 02/12/26, 23:04

    PageRenderer.php:983 Reply

    I can change it back, but having the empty string assigned as first parameter looked wired, and the function is still not strictly typed, it just felt better... 😅
  13. core-ci voted on patch set 9 V +1 02/12/26, 23:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95789

  14. Benjamin Franzke commented on patch set 9 02/16/26, 10:55

    PageRenderer.php:983 Reply

    The only change is that the namespace '"0"' is not omitted, which makes no difference for any realworld namespace usage. I think this is ok as a drive by. I think it would be better to use a namespace, but since this method allows non-namespaces usage, it's also fine to skip it and `null` is better as `""` then.
  15. Benjamin Kott uploaded patch set 10 V +1 02/16/26, 12:08

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

  17. Benjamin Kott updated the commit message in patch set 11 V +1 02/16/26, 13:51

  18. core-ci voted on patch set 11 V +1 02/16/26, 14:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95964

  19. Benjamin Franzke commented on patch set 11 CR -1 02/16/26, 14:44

    on it

    datetime-element.ts:78

    Derived values should be implemented in `willUpdate`, see https://lit.dev/docs/components/properties/#accessors-custom > To compute values from existing properties, we recommend using the willUpdate callback, which allows you to set values during the update cycle without triggering an additional update.

    datetime-element.ts:82

    This will also be true on initial render. That means the timer will be started twice (once in connectedCallback and once here). It can be removed in `connectedCallback()`, otherwise this could would need to be `if (changedProperties.has('mode') && changedProperties.get('mode') !== undefined)`, but removing it in connected callback is better.
  20. Benjamin Franzke uploaded patch set 12 CR -1 V +1 02/16/26, 15:04

  21. Benjamin Franzke commented on patch set 12 02/16/26, 15:04

    datetime-element.ts:78 Reply

    Done

    datetime-element.ts:82 Reply

    Done
  22. core-ci voted on patch set 12 V +1 02/16/26, 15:14 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95972

  23. Oli Bartsch voted on patch set 12 CR +1 V +1 02/16/26, 15:52

  24. Benjamin Kott voted on patch set 12 CR +2 V +2 02/16/26, 17:00

  25. Benjamin Kott merged patch set 13 02/16/26, 17:00