Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Location aware formatting? #702

Open
thiagomajesk opened this issue Jan 20, 2022 · 0 comments
Open

Location aware formatting? #702

thiagomajesk opened this issue Jan 20, 2022 · 0 comments

Comments

@thiagomajesk
Copy link

Hi! I can't find on the documentation if Timex is capable of doing something like this:

new Date().toLocaleString('en', {year: 'numeric', month: 'numeric', day: 'numeric'})
// >> '1/20/2022'
new Date().toLocaleString('pt-BR', {year: 'numeric', month: 'numeric', day: 'numeric'})
// >> '20/01/2022'

I see that many directives are documented in the Timex.Format.DateTime.Formatters.Default page, but I can't find a non-hard-coded way of defining a short date formats like this that are aware of the user's locale.

PS.: I've seen people in the community recommending ex_cldr and ex_cldr_dates_times, but the locales are not "compatible" with Timex. For instance, there's no pt-BR locale, only pt and pt-PT (elixir-cldr/cldr#42), the first one being the "correct" format according to the spec they are following, which makes interop kind of a PITA tbh since we are storing Timex locales.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant