summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/Temporal/PlainYearMonth/prototype/toLocaleString/dateStyle.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/intl402/Temporal/PlainYearMonth/prototype/toLocaleString/dateStyle.js')
-rw-r--r--js/src/tests/test262/intl402/Temporal/PlainYearMonth/prototype/toLocaleString/dateStyle.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/js/src/tests/test262/intl402/Temporal/PlainYearMonth/prototype/toLocaleString/dateStyle.js b/js/src/tests/test262/intl402/Temporal/PlainYearMonth/prototype/toLocaleString/dateStyle.js
new file mode 100644
index 0000000000..b4816e1b19
--- /dev/null
+++ b/js/src/tests/test262/intl402/Temporal/PlainYearMonth/prototype/toLocaleString/dateStyle.js
@@ -0,0 +1,34 @@
+// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
+// Copyright (C) 2024 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-temporal.plainyearmonth.prototype.tolocalestring
+description: Basic tests that dateStyle option affects output
+locale: [en-u-ca-gregory, en-u-ca-islamic]
+features: [Temporal, Intl.DateTimeFormat-datetimestyle]
+---*/
+
+const dateGregorian = Temporal.PlainYearMonth.from({ year: 2024, monthCode: "M03", calendar: "gregory" });
+
+assert(
+ dateGregorian.toLocaleString("en-u-ca-gregory", { dateStyle: "long" }).includes("March"),
+ "dateStyle: long writes month of March out in full"
+);
+assert(
+ !dateGregorian.toLocaleString("en-u-ca-gregory", { dateStyle: "short" }).includes("March"),
+ "dateStyle: short does not write month of March out in full"
+);
+
+const dateIslamic = Temporal.PlainYearMonth.from({ year: 1445, monthCode: "M09", calendar: "islamic" });
+
+assert(
+ dateIslamic.toLocaleString("en-u-ca-islamic", { dateStyle: "long" }).includes("Ramadan"),
+ "dateStyle: long writes month of Ramadan out in full"
+);
+assert(
+ !dateIslamic.toLocaleString("en-u-ca-islamic", { dateStyle: "short" }).includes("Ramadan"),
+ "dateStyle: short does not write month of Ramadan out in full"
+);
+
+reportCompare(0, 0);