forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1521819: Add numberingSystem support to Intl.RelativeTimeFormat. …
…r=jwalden Differential Revision: https://phabricator.services.mozilla.com/D27070 --HG-- extra : moz-landing-system : lando
- Loading branch information
Showing
3 changed files
with
38 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
js/src/tests/non262/Intl/RelativeTimeFormat/numbering-system.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// |reftest| skip-if(!this.hasOwnProperty("Intl")) | ||
|
||
// Ensure passing the default numbering system leads to the same result as when | ||
// no explicit numbering system is present. | ||
// | ||
// This is a regression test for the ICU issue reported at | ||
// <https://unicode-org.atlassian.net/browse/ICU-20280>. | ||
|
||
for (var requestedLocale of [undefined, "en", "de", "fr"]) { | ||
var rtf = new Intl.RelativeTimeFormat(requestedLocale); | ||
var {locale, numberingSystem} = rtf.resolvedOptions(); | ||
var rtfNu = new Intl.RelativeTimeFormat(`${locale}-u-nu-${numberingSystem}`); | ||
|
||
for (var unit of ["year", "quarter", "month", "week", "day", "hour", "minute", "second"]) { | ||
for (var value of [-10, -3, -2, -1, 0, 1, 2, 3, 10]) { | ||
assertEq(rtfNu.format(value, unit), rtf.format(value, unit)); | ||
} | ||
} | ||
} | ||
|
||
if (typeof reportCompare === "function") | ||
reportCompare(0, 0); |