Make relative-time a self-maintaining custom element (#8134)

Fixes #8124
Replaces #8130

Use a custom element for relative-time. Thanks to @Beowulf for suggesting this approach.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8134
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Reviewed-by: Beowulf <beowulf@beocode.eu>
Co-authored-by: Benedikt Straub <benedikt-straub@web.de>
Co-committed-by: Benedikt Straub <benedikt-straub@web.de>
This commit is contained in:
Benedikt Straub 2025-06-10 20:12:21 +02:00 committed by Earl Warren
parent b97c462d2e
commit 9b6e3b61cf
2 changed files with 37 additions and 15 deletions

View file

@ -23,6 +23,7 @@ test('CalculateRelativeTimes', () => {
'relativetime.years': ['%d year ago', '%d years ago'],
};
const mock = document.createElement('relative-time');
document.body.append(mock);
const now = Date.parse('2024-10-27T04:05:30+01:00'); // One hour after DST switchover, CET.