Closed
Bug 1321789
Opened 9 years ago
Closed 9 years ago
Support "islamic-civil" in DateTimeFormat
Categories
(Core :: JavaScript: Internationalization API, defect)
Core
JavaScript: Internationalization API
Tracking
()
RESOLVED
FIXED
mozilla55
| Tracking | Status | |
|---|---|---|
| firefox55 | --- | fixed |
People
(Reporter: anba, Assigned: anba)
References
()
Details
Attachments
(1 file, 2 obsolete files)
|
25.04 KB,
patch
|
anba
:
review+
|
Details | Diff | Splinter Review |
Test case:
---
print(Intl.DateTimeFormat("ar-u-ca-islamic-civil").resolvedOptions().calendar);
---
Expected: Prints "islamic-civil"
Actual: Prints "islamic"
| Assignee | ||
Comment 1•9 years ago
|
||
Changes:
- Replace bcp47 subtag mapping with uloc_toUnicodeLocaleType (http://bugs.icu-project.org/trac/ticket/9620)
- ICU doesn't return calendar alias names (ethiopic-amete-alem, islamicc) from ucal_getKeywordValuesForLocale("ca", ...), so we need to add them manually
- Implement the changes from https://github.com/tc39/ecma402/pull/70/commits/7cb955c1f6bf00c4e218c6b87ee247a0e320187e
- Implement an improved version of https://github.com/tc39/ecma402/pull/74, PR for ecma402 is still TBD
- And move some rooted objects out of loops
Attachment #8816605 -
Flags: review?(jwalden+bmo)
| Assignee | ||
Comment 2•9 years ago
|
||
Updated to apply cleanly on inbound.
Attachment #8816605 -
Attachment is obsolete: true
Attachment #8816605 -
Flags: review?(jwalden+bmo)
Attachment #8822706 -
Flags: review?(jwalden+bmo)
Comment 3•9 years ago
|
||
Comment on attachment 8822706 [details] [diff] [review]
bug1321789.patch
Review of attachment 8822706 [details] [diff] [review]:
-----------------------------------------------------------------
::: js/src/builtin/Intl.cpp
@@ +832,5 @@
>
> // CountAvailable and GetAvailable describe the signatures used for ICU API
> // to determine available locales for various functionality.
> +using CountAvailable = int32_t (*)();
> +using GetAvailable = const char* (*)(int32_t localeIndex);
<3
::: js/src/builtin/Intl.js
@@ +1078,3 @@
> if (supportedExtension.length > 2) {
> + // Step 13.a.
> + var privateIndex = callFunction(std_String_indexOf, foundLocale, "-x-");
If I'm reading this correctly, and this locale is something ICU handed back to us as something it actually supported, and ICU always munges fully-privateuse locales into a default locale, could you assert that the locale doesn't start with "x-"?
::: js/src/tests/Intl/DateTimeFormat/calendar-aliases.js
@@ +7,5 @@
> + var dtfEthiopicAmeteAlem = new Intl.DateTimeFormat(`${locale}-ca-ethiopic-amete-alem`, opts);
> + var dtfEthioaa = new Intl.DateTimeFormat(`${locale}-ca-ethioaa`, opts);
> + var dtfEthiopic = new Intl.DateTimeFormat(`${locale}-ca-ethiopic`, opts);
> +
> + var date = new Date(2016, 0, 1);
|1 - 1| instead of 0, please (and elsewhere in this file).
::: js/src/tests/Intl/DateTimeFormat/islamic.js
@@ +22,5 @@
> +
> +// Test islamic-tbla (Tabular / Thursday epoch).
> +// Compare with islamic-civil (Tabular / Friday epoch).
> +function testIslamicTbla() {
> + var date = new Date(Date.UTC(2015, 0, 1));
Would prefer |1 - 1| to 0 for this (and similar for the other months throughout this file).
@@ +74,5 @@
> + for (var [gregorian, ummAlQura] of dates) {
> + var date = new Date(Date.UTC(gregorian.year, gregorian.month - 1, gregorian.day));
> +
> + // Use parseInt() to remove the trailing era indicator.
> + assertEq(parseInt(ummAlQuraDate(year, date)), ummAlQura.year);
Add a 10 radix here.
Attachment #8822706 -
Flags: review?(jwalden+bmo) → review+
Comment 4•9 years ago
|
||
(In reply to André Bargull from comment #1)
> - And move some rooted objects out of loops
Could you file a bug (CC me on it) to add static analysis to consider prohibiting Rooted locals inside loops? I'd be interested in seeing the cases where we fall down, because my guess is this wouldn't really hinder readability that much (and if it did, we could have the Rooted outside the loop and a renamed Rooted& inside it), and it's something we're looking out for anyway, so we might as well get proper enforcement of it.
| Assignee | ||
Comment 5•9 years ago
|
||
Applied review comments, carrying r+.
Attachment #8822706 -
Attachment is obsolete: true
Attachment #8864515 -
Flags: review+
| Assignee | ||
Comment 6•9 years ago
|
||
Try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=faaefdc7e042a51b24c6600f661df075912781b4
Keywords: checkin-needed
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/c07319097f3b
Support Unicode extensions with multiple value subtags in BCP47 language tags. r=Waldo
Keywords: checkin-needed
Comment 8•9 years ago
|
||
| bugherder | ||
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
status-firefox55:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Updated•9 years ago
|
status-firefox53:
affected → ---
You need to log in
before you can comment on or make changes to this bug.
Description
•