Open
Bug 1298794
Opened 8 years ago
Updated 2 months ago
Round tripping issues when retrieving resolved options from ICU pattern
Categories
(Core :: JavaScript: Internationalization API, defect, P5)
Core
JavaScript: Internationalization API
Tracking
()
NEW
Tracking | Status | |
---|---|---|
firefox51 | --- | affected |
People
(Reporter: anba, Unassigned)
References
(Blocks 1 open bug)
Details
Test case: --- var dtf1 = Intl.DateTimeFormat("zh-Hans-CN", {formatMatcher: "best fit", month: "narrow", day: "2-digit", timeZone: "UTC"}); var dtf2 = Intl.DateTimeFormat("zh-Hans-CN", {formatMatcher: "best fit", month: "numeric", day: "2-digit", timeZone: "UTC"}); // Resolved options for dtf1 and dtf2 are the same. print(JSON.stringify(dtf1.resolvedOptions())); print(JSON.stringify(dtf2.resolvedOptions())); var date = Date.UTC(2016, 7, 1); // Prints: 8月01日 print(dtf1.format(date)); // Prints: 8/01 print(dtf2.format(date)); --- |dtf1| and |dtf2| are both resolved to |{..., month: "numeric", day: "2-digit"}|, but they produce different outputs when formatting a date value. - The requested skeleton for |dtf1| is "MMMMMdd", which is resolved to the ICU pattern "M月dd日". - The requested skeleton for |dtf2| is "Mdd", which is resolved to the ICU pattern "M/dd". - "M月dd日" and "M/dd" are both resolved to month=numeric, day=2-digit in resolveICUPattern() [builtin/Intl.js]. This issue also seems to be a spec violation, [1] disallows multiple formats with the same property/property value pairs: --- [...] The value of this property must be an array of objects, each of which has a subset of the properties shown in Table 4, where each property must have one of the values specified for the property in Table 4. Multiple objects in an array may use the same subset of the properties as long as they have different values for the properties. [...] --- [1] https://tc39.github.io/ecma402/#sec-intl.datetimeformat-internal-slots
Updated•7 years ago
|
See Also: → http://bugs.icu-project.org/trac/ticket/13518
Updated•6 years ago
|
Priority: -- → P5
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•