summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/Temporal/ZonedDateTime/prototype/toLocaleString/options-undefined.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/intl402/Temporal/ZonedDateTime/prototype/toLocaleString/options-undefined.js')
-rw-r--r--js/src/tests/test262/intl402/Temporal/ZonedDateTime/prototype/toLocaleString/options-undefined.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/js/src/tests/test262/intl402/Temporal/ZonedDateTime/prototype/toLocaleString/options-undefined.js b/js/src/tests/test262/intl402/Temporal/ZonedDateTime/prototype/toLocaleString/options-undefined.js
new file mode 100644
index 0000000000..a1286949a9
--- /dev/null
+++ b/js/src/tests/test262/intl402/Temporal/ZonedDateTime/prototype/toLocaleString/options-undefined.js
@@ -0,0 +1,30 @@
+// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
+// Copyright (C) 2021 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-temporal.zoneddatetime.prototype.tolocalestring
+description: Verify that undefined options are handled correctly.
+features: [BigInt, Temporal]
+---*/
+
+const datetime = new Temporal.ZonedDateTime(957270896_987_650_000n, "UTC");
+const defaultFormatter = new Intl.DateTimeFormat('en', {
+ year: "numeric",
+ month: "numeric",
+ day: "numeric",
+ hour: "numeric",
+ minute: "numeric",
+ second: "numeric",
+ timeZoneName: "short",
+ timeZone: "UTC",
+});
+const expected = defaultFormatter.format(datetime.toInstant());
+
+const actualExplicit = datetime.toLocaleString('en', undefined);
+assert.sameValue(actualExplicit, expected, "default locale is determined by Intl.DateTimeFormat");
+
+const actualImplicit = datetime.toLocaleString('en');
+assert.sameValue(actualImplicit, expected, "default locale is determined by Intl.DateTimeFormat");
+
+reportCompare(0, 0);