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

datetime value not reflecting browser preferred locale?

thiagomajesk opened this issue · comments

Hi! I was testing this component today and noticed that the title attribute properly translates to my locale, but not the displayed value, which causes confusion. Looking at the examples page: https://github.github.io/time-elements/examples, this is what I see in my browser:

image

As you can see, the title is properly translated, but not the displayed value. This is the source from the page:

<local-time datetime="1970-01-01T00:00:00.000Z" weekday="short" year="numeric" month="short" day="numeric" hour="numeric" minute="2-digit" second="2-digit" title="31 de dez. de 1969 21:00 BRT">Wed 31 Dec 1969 21:00:00</local-time>

PS.: BTW, another thing that I'm trying to solve is that the component does not support something like month="numeric", which is the most common way of displaying dates in my current locale.

The time translates as well, but not the date, which divides the whole in some cases. Here's an example in arabic:
Screenshot from 2022-07-05 17-33-39

Looks like the remaining attributes are a must to force the element to display properly:
image

If you'd like to try the new release, I believe it has support for languages supported by the browser. Let me know your thoughts and if you have any more ideas on what we could do here.