diff options
Diffstat (limited to 'js/src/tests/test262/intl402/Temporal/ZonedDateTime/prototype/toLocaleString/locales-undefined.js')
-rw-r--r-- | js/src/tests/test262/intl402/Temporal/ZonedDateTime/prototype/toLocaleString/locales-undefined.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/js/src/tests/test262/intl402/Temporal/ZonedDateTime/prototype/toLocaleString/locales-undefined.js b/js/src/tests/test262/intl402/Temporal/ZonedDateTime/prototype/toLocaleString/locales-undefined.js new file mode 100644 index 0000000000..8f4f19308a --- /dev/null +++ b/js/src/tests/test262/intl402/Temporal/ZonedDateTime/prototype/toLocaleString/locales-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: Omitting the locales argument defaults to the DateTimeFormat default +features: [BigInt, Temporal] +---*/ + +const datetime = new Temporal.ZonedDateTime(957270896_987_650_000n, "UTC"); +const defaultFormatter = new Intl.DateTimeFormat([], { + 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(undefined); +assert.sameValue(actualExplicit, expected, "default locale is determined by Intl.DateTimeFormat"); + +const actualImplicit = datetime.toLocaleString(); +assert.sameValue(actualImplicit, expected, "default locale is determined by Intl.DateTimeFormat"); + +reportCompare(0, 0); |