diff options
Diffstat (limited to '')
-rw-r--r-- | js/src/tests/test262/staging/Temporal/Instant/old/toZonedDateTimeISO.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/js/src/tests/test262/staging/Temporal/Instant/old/toZonedDateTimeISO.js b/js/src/tests/test262/staging/Temporal/Instant/old/toZonedDateTimeISO.js new file mode 100644 index 0000000000..2fbaad8b9d --- /dev/null +++ b/js/src/tests/test262/staging/Temporal/Instant/old/toZonedDateTimeISO.js @@ -0,0 +1,28 @@ +// |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-instant-objects +description: Temporal.Instant.toZonedDateTimeISO() works +features: [Temporal] +---*/ + +var inst = Temporal.Instant.from("1976-11-18T14:23:30.123456789Z"); + +// throws without parameter +assert.throws(TypeError, () => inst.toZonedDateTimeISO()); + +// time zone parameter UTC +var tz = Temporal.TimeZone.from("UTC"); +var zdt = inst.toZonedDateTimeISO(tz); +assert.sameValue(inst.epochNanoseconds, zdt.epochNanoseconds); +assert.sameValue(`${ zdt }`, "1976-11-18T14:23:30.123456789+00:00[UTC]"); + +// time zone parameter non-UTC +var tz = Temporal.TimeZone.from("-05:00"); +var zdt = inst.toZonedDateTimeISO(tz); +assert.sameValue(inst.epochNanoseconds, zdt.epochNanoseconds); +assert.sameValue(`${ zdt }`, "1976-11-18T09:23:30.123456789-05:00[-05:00]"); + +reportCompare(0, 0); |