github / relative-time-element

Web component extensions to the standard <time> element.

Home Page:https://github.github.io/relative-time-element/examples/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Relative times show as e.g. "-10 d" in unsupported languages

JasonBarnabe opened this issue · comments

If the language is not supported (like Esperanto), relative dates show like "-10 d". More reasonable would be to fall back to English.

If you'd like to try the new release I believe this issue is likely fixed. If not let me know and we can revisit it.

This is not fixed in the new release, still showing things like -10 d for Esperanto.

Are you using the micro format?

No, just <relative-time prefix="">.

Would you kindly present a full reproduction? Are you using the lang attribute to render a page in the Esperanto locale? I'm unsure why it would render -10 d if you're not specifying the micro format, unless that is particular to the browsers Esperanto locale, or perhaps it's an unrecognised locale and is doing something undesirable?

Live example at https://greasyfork.org/eo/scripts/370634?locale_override=1 - the date is next to text Ĝisdatigita. HTML is:

<relative-time datetime="2022-11-01T03:31:12+00:00" prefix="">2022/11/01</relative-time>

JS is:

import '@github/time-elements';

Page has:

<html lang="eo">

Result is (currently) -6 d.

It looks like this is perhaps an error in the browser's implementation or perhaps poor ICU data?

It looks like the resolvedOptions are correctly returning eo so this is how the browser is deciding to interpret that relative time. I think this might be worth raising with browser vendors like the Safari tracker. There's little we can do (because providing a fallback won't work as the browser is successfully resolving this locale).

OK, understood this may be a browser issue. I leave it up to you whether to raise it with them as I'm not familiar with the technical details. Thanks for checking.