Debian Codegraph @

js/src/tests/non262/Intl/DateTimeFormat/calendar-aliases.js

raw
1 // |reftest| skip-if(!this.hasOwnProperty("Intl"))
2
3 // Ensure ethiopic-amete-alem is resolved to ethioaa instead of ethiopic.
4 function testEthiopicAmeteAlem() {
5 var locale = "am-ET-u-nu-latn";
6 var opts = {timeZone: "Africa/Addis_Ababa"};
7 var dtfEthiopicAmeteAlem = new Intl.DateTimeFormat(`${locale}-ca-ethiopic-amete-alem`, opts);
8 var dtfEthioaa = new Intl.DateTimeFormat(`${locale}-ca-ethioaa`, opts);
9 var dtfEthiopic = new Intl.DateTimeFormat(`${locale}-ca-ethiopic`, opts);
10
11 var date = new Date(2016, 1 - 1, 1);
12
13 assertEq(dtfEthiopicAmeteAlem.format(date), dtfEthioaa.format(date));
14 assertEq(dtfEthiopicAmeteAlem.format(date) === dtfEthiopic.format(date), false);
15 }
16
17 // Ensure islamicc is resolved to islamic-civil.
18 function testIslamicCivil() {
19 var locale = "ar-SA-u-nu-latn";
20 var opts = {timeZone: "Asia/Riyadh"};
21 var dtfIslamicCivil = new Intl.DateTimeFormat(`${locale}-ca-islamic-civil`, opts);
22 var dtfIslamicc = new Intl.DateTimeFormat(`${locale}-ca-islamicc`, opts);
23 var dtfIslamic = new Intl.DateTimeFormat(`${locale}-ca-islamic`, opts);
24
25 var date = new Date(2016, 1 - 1, 1);
26
27 assertEq(dtfIslamicCivil.format(date), dtfIslamicc.format(date));
28 assertEq(dtfIslamicCivil.format(date) === dtfIslamic.format(date), false);
29 }
30
31 testEthiopicAmeteAlem();
32 testIslamicCivil();
33
34 if (typeof reportCompare === "function")
35 reportCompare(0, 0, "ok");