diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /js/src/tests/test262/staging/Intl402/Temporal/old/japanese-era.js | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/staging/Intl402/Temporal/old/japanese-era.js')
-rw-r--r-- | js/src/tests/test262/staging/Intl402/Temporal/old/japanese-era.js | 140 |
1 files changed, 140 insertions, 0 deletions
diff --git a/js/src/tests/test262/staging/Intl402/Temporal/old/japanese-era.js b/js/src/tests/test262/staging/Intl402/Temporal/old/japanese-era.js new file mode 100644 index 0000000000..47e16fbcb5 --- /dev/null +++ b/js/src/tests/test262/staging/Intl402/Temporal/old/japanese-era.js @@ -0,0 +1,140 @@ +// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally +// Copyright (C) 2018 Bloomberg LP. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal-intl +description: Japanese eras +features: [Temporal] +---*/ + + +// Reiwa (2019-) +var date = Temporal.PlainDate.from({ + era: "reiwa", + eraYear: 2, + month: 1, + day: 1, + calendar: "japanese" +}); +assert.sameValue(`${ date }`, "2020-01-01[u-ca=japanese]"); + +// Heisei (1989-2019) +var date = Temporal.PlainDate.from({ + era: "heisei", + eraYear: 2, + month: 1, + day: 1, + calendar: "japanese" +}); +assert.sameValue(`${ date }`, "1990-01-01[u-ca=japanese]"); + +// Showa (1926-1989) +var date = Temporal.PlainDate.from({ + era: "showa", + eraYear: 2, + month: 1, + day: 1, + calendar: "japanese" +}); +assert.sameValue(`${ date }`, "1927-01-01[u-ca=japanese]"); + +// Taisho (1912-1926) +var date = Temporal.PlainDate.from({ + era: "taisho", + eraYear: 2, + month: 1, + day: 1, + calendar: "japanese" +}); +assert.sameValue(`${ date }`, "1913-01-01[u-ca=japanese]"); + +// Meiji (1868-1912) +var date = Temporal.PlainDate.from({ + era: "meiji", + eraYear: 2, + month: 1, + day: 1, + calendar: "japanese" +}); +assert.sameValue(`${ date }`, "1869-01-01[u-ca=japanese]"); + +// Dates in same year before Japanese era starts will resolve to previous era +var date = Temporal.PlainDate.from({ + era: "reiwa", + eraYear: 1, + month: 1, + day: 1, + calendar: "japanese" +}); +assert.sameValue(`${ date }`, "2019-01-01[u-ca=japanese]"); +assert.sameValue(date.era, "heisei"); +assert.sameValue(date.eraYear, 31); + +date = Temporal.PlainDate.from({ + era: "heisei", + eraYear: 1, + month: 1, + day: 1, + calendar: "japanese" +}); +assert.sameValue(`${ date }`, "1989-01-01[u-ca=japanese]"); +assert.sameValue(date.era, "showa"); +assert.sameValue(date.eraYear, 64); +date = Temporal.PlainDate.from({ + era: "showa", + eraYear: 1, + month: 1, + day: 1, + calendar: "japanese" +}); +assert.sameValue(`${ date }`, "1926-01-01[u-ca=japanese]"); +assert.sameValue(date.era, "taisho"); +assert.sameValue(date.eraYear, 15); + +date = Temporal.PlainDate.from({ + era: "taisho", + eraYear: 1, + month: 1, + day: 1, + calendar: "japanese" +}); +assert.sameValue(`${ date }`, "1912-01-01[u-ca=japanese]"); +assert.sameValue(date.era, "meiji"); +assert.sameValue(date.eraYear, 45); + +date = Temporal.PlainDate.from({ + era: "meiji", + eraYear: 1, + month: 1, + day: 1, + calendar: "japanese" +}); +assert.sameValue(`${ date }`, "1868-01-01[u-ca=japanese]"); +assert.sameValue(date.era, "ce"); +assert.sameValue(date.eraYear, 1868); + +// Verify that CE and BCE eras (before Meiji) are recognized +date = Temporal.PlainDate.from({ + era: "ce", + eraYear: 1000, + month: 1, + day: 1, + calendar: "japanese" +}); +assert.sameValue(`${date}`, "1000-01-01[u-ca=japanese]"); +assert.sameValue(date.era, "ce"); +assert.sameValue(date.eraYear, 1000); + +date = Temporal.PlainDate.from({ + era: "bce", + eraYear: 1, + month: 1, + day: 1, + calendar: "japanese" +}); +assert.sameValue(`${date}`, "0000-01-01[u-ca=japanese]"); +assert.sameValue(date.era, "bce"); +assert.sameValue(date.eraYear, 1); + +reportCompare(0, 0); |