mirror of
https://github.com/tc39/test262.git
synced 2025-11-18 04:39:44 +01:00
Intl Era Monthcode: DateTimeFormat.resolvedOptions().calendar
Tests the Intl.DateTimeFormat.prototype.resolvedOptions().calendar value for each supported calendar. Co-Authored-By: Philip Chimento <pchimento@igalia.com>
This commit is contained in:
parent
0186d50ba0
commit
a4c57b679b
45
test/intl402/DateTimeFormat/prototype/resolvedOptions/calendar.js
vendored
Normal file
45
test/intl402/DateTimeFormat/prototype/resolvedOptions/calendar.js
vendored
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
// Copyright (C) 2025 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-intl.datetimeformat.prototype.resolvedoptions
|
||||||
|
description: Verifies that the calendar option is respected.
|
||||||
|
locale: [en]
|
||||||
|
features: [Intl.Era-monthcode]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const tests = [
|
||||||
|
"buddhist",
|
||||||
|
"chinese",
|
||||||
|
"coptic",
|
||||||
|
"dangi",
|
||||||
|
"ethioaa",
|
||||||
|
"ethiopic",
|
||||||
|
"gregory",
|
||||||
|
"hebrew",
|
||||||
|
"indian",
|
||||||
|
"islamic-civil",
|
||||||
|
"islamic-tbla",
|
||||||
|
"islamic-umalqura",
|
||||||
|
"iso8601",
|
||||||
|
"japanese",
|
||||||
|
"persian",
|
||||||
|
"roc",
|
||||||
|
];
|
||||||
|
|
||||||
|
for (const calendar of tests) {
|
||||||
|
const formatter = new Intl.DateTimeFormat("en", { calendar });
|
||||||
|
const options = formatter.resolvedOptions();
|
||||||
|
assert.sameValue(options.calendar, calendar, "Resolved calendar");
|
||||||
|
}
|
||||||
|
|
||||||
|
const aliases = [
|
||||||
|
["ethiopic-amete-alem", "ethioaa"],
|
||||||
|
["islamicc", "islamic-civil"],
|
||||||
|
];
|
||||||
|
|
||||||
|
for (const [alias, calendar] of aliases) {
|
||||||
|
const formatter = new Intl.DateTimeFormat("en", { calendar: alias });
|
||||||
|
const options = formatter.resolvedOptions();
|
||||||
|
assert.sameValue(options.calendar, calendar, "Resolved alias " + alias);
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user