2021-09-10 23:54:20 +02:00
|
|
|
// 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.now.zoneddatetimeiso
|
2021-09-11 02:33:55 +02:00
|
|
|
description: Functions when time zone argument is omitted
|
2021-09-10 23:54:20 +02:00
|
|
|
includes: [compareArray.js]
|
|
|
|
features: [Temporal]
|
|
|
|
---*/
|
|
|
|
|
|
|
|
const actual = [];
|
|
|
|
const expected = [];
|
|
|
|
|
|
|
|
Object.defineProperty(Temporal.TimeZone, "from", {
|
|
|
|
get() {
|
|
|
|
actual.push("get Temporal.TimeZone.from");
|
|
|
|
return undefined;
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2023-01-06 03:04:58 +01:00
|
|
|
const systemTimeZone = Temporal.Now.timeZoneId();
|
2021-09-10 23:54:20 +02:00
|
|
|
|
|
|
|
const resultExplicit = Temporal.Now.zonedDateTimeISO(undefined);
|
2023-02-17 22:05:30 +01:00
|
|
|
assert.sameValue(resultExplicit.getISOFields().timeZone, systemTimeZone, "time zone slot should store a string");
|
2021-09-10 23:54:20 +02:00
|
|
|
|
|
|
|
assert.compareArray(actual, expected, "Temporal.TimeZone.from should not be called");
|
|
|
|
|
|
|
|
const resultImplicit = Temporal.Now.zonedDateTimeISO();
|
2023-02-17 22:05:30 +01:00
|
|
|
assert.sameValue(resultImplicit.getISOFields().timeZone, systemTimeZone, "time zone slot should store a string");
|
2021-09-10 23:54:20 +02:00
|
|
|
|
|
|
|
assert.compareArray(actual, expected, "Temporal.TimeZone.from should not be called");
|