Incorrect date format for Haiti
Categories
(Core :: JavaScript: Internationalization API, defect)
Tracking
()
People
(Reporter: brandonesbox, Unassigned)
Details
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:90.0) Gecko/20100101 Firefox/90.0
Steps to reproduce:
In the browser console, run
(new Intl.DateTimeFormat("ht")).format(new Date("2021-08-04"))
Actual results:
"8/3/2021"
Expected results:
"3/8/2021"
Reporter | ||
Comment 1•3 years ago
|
||
Oops, I'm just realizing that Firefox might not have any internationalization support for Haiti. Using the i18n scheme for French would be a huge improvement.
(new Intl.DateTimeFormat("ht", { dateStyle: "full" })).format(new Date("2020-03-01"))
-> "Saturday, February 29, 2020"
Comment 2•3 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::JavaScript: Internationalization API' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.
Comment 3•3 years ago
|
||
That's because ht
is not the right BCP47 language identifier for Haiti. It's fr-HT
:
(new Intl.DateTimeFormat("fr-HT")).format(new Date("2021-08-04"))
"03/08/2021"
You can verify that by checking (new Intl.DateTimeFormat("fr-HT")).resolvedOptions().locale
and the list of locales here: https://github.com/unicode-org/cldr-json/tree/master/cldr-json/cldr-dates-modern/main
Comment 4•3 years ago
|
||
Closing as INVALID per comment #3.
Reporter | ||
Comment 5•3 years ago
|
||
ht
is the language identifier for Hatian Creole, the other official language of Haiti. https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/language_territory_information.html
I suppose I should take it up with CLDR, since they seem not to have published to https://github.com/unicode-org/cldr-json/tree/master/cldr-json/cldr-dates-modern/main yet?
Comment 6•3 years ago
|
||
yes! And for many use cases you can also suggest they add fallback from ht
to fr-HT
to improve on the current ht
-> en-GB
fallback :)
Reporter | ||
Comment 7•3 years ago
|
||
Great, thank you!
Description
•