-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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
ToLocaleDateString inconsistent/wrong output locale to "en-CA" #45945
Comments
Node >= v19.1.0 ships with a newer version of ICU (i18n library), that's why there's a difference. There's no bug, it's working as expected, so I'll go ahead and close the issue but I can convert it to a discussion if you have follow-up questions. |
@bnoordhuis do you have any links to find out more about where this change came from and why? I had no experience with ICU before, I might be talking nonsense. |
Here you go, it's something of a rabbit hole: https://icu.unicode.org/download/72 <- this is the ICU upgrade, which in turn... It's the removal of the |
thank you @bnoordhuis for taking the time to pull those links, super appreciated! 🙏 |
And removing that line, per vetter feedback, leaving the pattern for Working as designed, for v8, Node, ICU, CLDR process, etc. |
What is going on here? Canada specifies yyyy-mm-dd. The new implementation is incorrect:
Is the issue being tracked somewhere? |
It's being discussed upstream in CLDR at https://unicode-org.atlassian.net/browse/CLDR-16399 A change, not necessarily a regression. |
You can use |
reverted the change in CLDR v43 (ICU 73.1) |
Therefore it should be changed in a upcoming node version. |
Version
19.1.0, 19.2.0, 19.3.0
Platform
Microsoft Windows NT 10.0.22621.0 x64, Linux crowrvostation 5.15.79.1-microsoft-standard-WSL2 #1 SMP Wed Nov 23 01:01:46 UTC 2022 x86_64 GNU/Linux (Arch Linux), Linux pop-os 6.0.3-1606004-generic #202210211149
22.041891946 SMP PREEMPT_DYBAMIC Sat O x86_64 x86_64 x86_64 GNU/LinuxSubsystem
No response
What steps will reproduce the bug?
After install node, just run a script or eval with new Date().toLocaleDateString("en-CA");
How often does it reproduce? Is there a required condition?
no conditions, just install and run
What is the expected behavior?
node 18.12.1 pop-os
![image](https://user-images.githubusercontent.com/56355669/209207762-506419a1-1fa8-4658-ba29-2ec4204d8d6f.png)
![image](https://user-images.githubusercontent.com/56355669/209207919-1e659aba-43d4-456f-b824-e22004ff6046.png)
19.0.0 arch linux wsl win 11
Browser output - just for comparison
![image](https://user-images.githubusercontent.com/56355669/209210332-28745eb1-be6e-4d42-a7dd-1fa380e901a5.png)
What do you see instead?
node 19.1.0 wsl Arch win-11
![image](https://user-images.githubusercontent.com/56355669/209208422-31c04d6b-4be8-45d6-9864-3798364c9fb1.png)
node 19.2.0 wsl Arch win-11
![image](https://user-images.githubusercontent.com/56355669/209208610-92e705c1-6fc7-4f9a-b165-7529c8e5308d.png)
node 19.3.0 wsl Arch win-11
![image](https://user-images.githubusercontent.com/56355669/209208808-04e7abb1-ce55-4fdb-a42b-584dd8ead6ab.png)
node 19.3.0 win-11
![image](https://user-images.githubusercontent.com/56355669/209208933-8df06f6e-ca63-46f1-90da-16143a3f4754.png)
node 19.3.0 pop-os
![image](https://user-images.githubusercontent.com/56355669/209209432-c9de970f-e84a-4580-b0ab-48f6ee0a0313.png)
Additional information
even if there is no bugs, this inconsistent can break some systems that use then to date format, like me that use in a api as date range.
To get the format YYYY-MM-DD you could return to node 19.0.0 or use 'sv-SE' locale instead
Below some others locales that i'ave tested that properly works
![image](https://user-images.githubusercontent.com/56355669/209210803-b5a91e73-83cb-431e-b1b6-69ee716dc1d0.png)
The text was updated successfully, but these errors were encountered: