-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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 does not handle zh-CN properly #42030
Comments
This is almost certainly due to the update to ICU 70.1 (#41525) which was done to update the timezone information. In previous issues reporting formatting changes it has been stated by people more familiar with ICU that the exact format of locale strings should not be depended upon to remain invariant:
Ref: #38897 (comment) FWIW adding the const dateWithTimeOptions = Object.freeze({
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: 'numeric',
minute: 'numeric',
hour12: true,
});
const localTime = Date.now();
const str = new Date(localTime).toLocaleDateString('zh-CN', dateWithTimeOptions);
console.log(str); |
@FredrikL specifically, CLDR-10560 consensus was:
Definitely use |
FYI (and @richardlau perhaps this could be made more prominent somewhere) : the CLDR project has delta charts, accessible by https://cldr.unicode.org/index/charts - you can see what changed from release to release. |
not a bug, closing |
Version
16.14
Platform
MacOS 12.2.1 & Github Actions linux based runners
Subsystem
icu
What steps will reproduce the bug?
The following script can be used to reproduce
How often does it reproduce? Is there a required condition?
No response
What is the expected behavior?
Output with 16.13 (expected)
2022/02/17 下午3:42
What do you see instead?
Output with 16.14
2022/02/17 15:42
Additional information
No response
The text was updated successfully, but these errors were encountered: