mirror of
https://github.com/tc39/test262.git
synced 2025-07-27 16:04:36 +02:00
Remove support for nested Temporal time zone property bags
Previously, "nested" time zone property bags were unwrapped up to one level. That is, this object: { timeZone: { // ...Temporal.TimeZone methods } } would not be considered to implement the TimeZone protocol, but would have its timeZone property used instead, if it were passed to an API that required a TimeZone protocol object. These nested property bags are no longer supported. Discussion: https://github.com/tc39/proposal-temporal/issues/2104#issuecomment-1409549753 Corresponding normative PR: https://github.com/tc39/proposal-temporal/pull/2485
This commit is contained in:
parent
886656756f
commit
24def913ec
@ -193,7 +193,6 @@ const expectedOpsForZonedRelativeTo = expected.concat([
|
|||||||
"call options.relativeTo.year.valueOf",
|
"call options.relativeTo.year.valueOf",
|
||||||
"get options.relativeTo.calendar.dateFromFields",
|
"get options.relativeTo.calendar.dateFromFields",
|
||||||
"call options.relativeTo.calendar.dateFromFields",
|
"call options.relativeTo.calendar.dateFromFields",
|
||||||
"has options.relativeTo.timeZone.timeZone",
|
|
||||||
"get options.relativeTo.timeZone.getPossibleInstantsFor",
|
"get options.relativeTo.timeZone.getPossibleInstantsFor",
|
||||||
"call options.relativeTo.timeZone.getPossibleInstantsFor",
|
"call options.relativeTo.timeZone.getPossibleInstantsFor",
|
||||||
"get options.relativeTo.timeZone.getOffsetNanosecondsFor",
|
"get options.relativeTo.timeZone.getOffsetNanosecondsFor",
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.duration.compare
|
|
||||||
description: >
|
|
||||||
A Temporal.TimeZone instance passed to compare() does not have its
|
|
||||||
'timeZone' property observably checked
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const timeZone = new Temporal.TimeZone("UTC");
|
|
||||||
Object.defineProperty(timeZone, "timeZone", {
|
|
||||||
get() {
|
|
||||||
throw new Test262Error("timeZone.timeZone should not be accessed");
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
|
|
||||||
Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } });
|
|
@ -9,7 +9,6 @@ features: [Temporal]
|
|||||||
|
|
||||||
let timeZone = "2021-08-19T17:30";
|
let timeZone = "2021-08-19T17:30";
|
||||||
assert.throws(RangeError, () => Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), "bare date-time string is not a time zone");
|
assert.throws(RangeError, () => Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), "bare date-time string is not a time zone");
|
||||||
assert.throws(RangeError, () => Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), "bare date-time string is not a time zone");
|
|
||||||
|
|
||||||
// The following are all valid strings so should not throw:
|
// The following are all valid strings so should not throw:
|
||||||
|
|
||||||
@ -30,5 +29,4 @@ assert.throws(RangeError, () => Temporal.Duration.compare(new Temporal.Duration(
|
|||||||
"2021-08-19T1730-0700[UTC]",
|
"2021-08-19T1730-0700[UTC]",
|
||||||
].forEach((timeZone) => {
|
].forEach((timeZone) => {
|
||||||
Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
|
Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
|
||||||
Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } });
|
|
||||||
});
|
});
|
||||||
|
@ -9,12 +9,10 @@ features: [Temporal]
|
|||||||
|
|
||||||
let timeZone = "2016-12-31T23:59:60+00:00[UTC]";
|
let timeZone = "2016-12-31T23:59:60+00:00[UTC]";
|
||||||
|
|
||||||
// A string with a leap second is a valid ISO string, so the following two
|
// A string with a leap second is a valid ISO string, so the following
|
||||||
// operations should not throw
|
// operation should not throw
|
||||||
|
|
||||||
Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
|
Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
|
||||||
Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } });
|
|
||||||
|
|
||||||
timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]";
|
timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]";
|
||||||
assert.throws(RangeError, () => Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), "leap second in time zone name not valid");
|
assert.throws(RangeError, () => Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), "leap second in time zone name not valid");
|
||||||
assert.throws(RangeError, () => Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), "leap second in time zone name not valid (nested property)");
|
|
||||||
|
@ -17,9 +17,4 @@ invalidStrings.forEach((timeZone) => {
|
|||||||
() => Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }),
|
() => Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }),
|
||||||
"reject minus zero as extended year"
|
"reject minus zero as extended year"
|
||||||
);
|
);
|
||||||
assert.throws(
|
|
||||||
RangeError,
|
|
||||||
() => Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }),
|
|
||||||
"reject minus zero as extended year (nested property)"
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
@ -21,7 +21,6 @@ const rangeErrorTests = [
|
|||||||
|
|
||||||
for (const [timeZone, description] of rangeErrorTests) {
|
for (const [timeZone, description] of rangeErrorTests) {
|
||||||
assert.throws(RangeError, () => Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), `${description} does not convert to a valid ISO string`);
|
assert.throws(RangeError, () => Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), `${description} does not convert to a valid ISO string`);
|
||||||
assert.throws(RangeError, () => Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), `${description} does not convert to a valid ISO string (nested property)`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
@ -30,8 +29,4 @@ const typeErrorTests = [
|
|||||||
|
|
||||||
for (const [timeZone, description] of typeErrorTests) {
|
for (const [timeZone, description] of typeErrorTests) {
|
||||||
assert.throws(TypeError, () => Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), `${description} is not a valid object and does not convert to a string`);
|
assert.throws(TypeError, () => Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), `${description} is not a valid object and does not convert to a string`);
|
||||||
assert.throws(TypeError, () => Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), `${description} is not a valid object and does not convert to a string (nested property)`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const timeZone = undefined;
|
|
||||||
assert.throws(RangeError, () => Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), `undefined is always a RangeError as nested property`);
|
|
||||||
|
@ -177,8 +177,6 @@ const expectedOpsForZonedRelativeTo = expected.concat([
|
|||||||
// InterpretTemporalDateTimeFields
|
// InterpretTemporalDateTimeFields
|
||||||
"get options.relativeTo.calendar.dateFromFields",
|
"get options.relativeTo.calendar.dateFromFields",
|
||||||
"call options.relativeTo.calendar.dateFromFields",
|
"call options.relativeTo.calendar.dateFromFields",
|
||||||
// ToRelativeTemporalObject again
|
|
||||||
"has options.relativeTo.timeZone.timeZone",
|
|
||||||
// InterpretISODateTimeOffset
|
// InterpretISODateTimeOffset
|
||||||
"get options.relativeTo.timeZone.getPossibleInstantsFor",
|
"get options.relativeTo.timeZone.getPossibleInstantsFor",
|
||||||
"call options.relativeTo.timeZone.getPossibleInstantsFor",
|
"call options.relativeTo.timeZone.getPossibleInstantsFor",
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.duration.prototype.add
|
|
||||||
description: >
|
|
||||||
A Temporal.TimeZone instance passed to add() does not have its
|
|
||||||
'timeZone' property observably checked
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const instance = new Temporal.Duration(1);
|
|
||||||
|
|
||||||
const timeZone = new Temporal.TimeZone("UTC");
|
|
||||||
Object.defineProperty(timeZone, "timeZone", {
|
|
||||||
get() {
|
|
||||||
throw new Test262Error("timeZone.timeZone should not be accessed");
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
|
|
||||||
instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } });
|
|
@ -11,7 +11,6 @@ const instance = new Temporal.Duration(1);
|
|||||||
|
|
||||||
let timeZone = "2021-08-19T17:30";
|
let timeZone = "2021-08-19T17:30";
|
||||||
assert.throws(RangeError, () => instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), "bare date-time string is not a time zone");
|
assert.throws(RangeError, () => instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), "bare date-time string is not a time zone");
|
||||||
assert.throws(RangeError, () => instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), "bare date-time string is not a time zone");
|
|
||||||
|
|
||||||
// The following are all valid strings so should not throw:
|
// The following are all valid strings so should not throw:
|
||||||
|
|
||||||
@ -32,5 +31,4 @@ assert.throws(RangeError, () => instance.add(new Temporal.Duration(1), { relativ
|
|||||||
"2021-08-19T1730-0700[UTC]",
|
"2021-08-19T1730-0700[UTC]",
|
||||||
].forEach((timeZone) => {
|
].forEach((timeZone) => {
|
||||||
instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
|
instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
|
||||||
instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } });
|
|
||||||
});
|
});
|
||||||
|
@ -10,12 +10,10 @@ features: [Temporal]
|
|||||||
const instance = new Temporal.Duration(1);
|
const instance = new Temporal.Duration(1);
|
||||||
let timeZone = "2016-12-31T23:59:60+00:00[UTC]";
|
let timeZone = "2016-12-31T23:59:60+00:00[UTC]";
|
||||||
|
|
||||||
// A string with a leap second is a valid ISO string, so the following two
|
// A string with a leap second is a valid ISO string, so the following
|
||||||
// operations should not throw
|
// operation should not throw
|
||||||
|
|
||||||
instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
|
instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
|
||||||
instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } });
|
|
||||||
|
|
||||||
timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]";
|
timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]";
|
||||||
assert.throws(RangeError, () => instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), "leap second in time zone name not valid");
|
assert.throws(RangeError, () => instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), "leap second in time zone name not valid");
|
||||||
assert.throws(RangeError, () => instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), "leap second in time zone name not valid (nested property)");
|
|
||||||
|
@ -18,9 +18,4 @@ invalidStrings.forEach((timeZone) => {
|
|||||||
() => instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }),
|
() => instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }),
|
||||||
"reject minus zero as extended year"
|
"reject minus zero as extended year"
|
||||||
);
|
);
|
||||||
assert.throws(
|
|
||||||
RangeError,
|
|
||||||
() => instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }),
|
|
||||||
"reject minus zero as extended year (nested property)"
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
@ -23,7 +23,6 @@ const rangeErrorTests = [
|
|||||||
|
|
||||||
for (const [timeZone, description] of rangeErrorTests) {
|
for (const [timeZone, description] of rangeErrorTests) {
|
||||||
assert.throws(RangeError, () => instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), `${description} does not convert to a valid ISO string`);
|
assert.throws(RangeError, () => instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), `${description} does not convert to a valid ISO string`);
|
||||||
assert.throws(RangeError, () => instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), `${description} does not convert to a valid ISO string (nested property)`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
@ -32,8 +31,4 @@ const typeErrorTests = [
|
|||||||
|
|
||||||
for (const [timeZone, description] of typeErrorTests) {
|
for (const [timeZone, description] of typeErrorTests) {
|
||||||
assert.throws(TypeError, () => instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), `${description} is not a valid object and does not convert to a string`);
|
assert.throws(TypeError, () => instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), `${description} is not a valid object and does not convert to a string`);
|
||||||
assert.throws(TypeError, () => instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), `${description} is not a valid object and does not convert to a string (nested property)`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const timeZone = undefined;
|
|
||||||
assert.throws(RangeError, () => instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), `undefined is always a RangeError as nested property`);
|
|
||||||
|
@ -270,7 +270,6 @@ const expectedOpsForZonedRelativeTo = [
|
|||||||
"call options.relativeTo.year.valueOf",
|
"call options.relativeTo.year.valueOf",
|
||||||
"get options.relativeTo.calendar.dateFromFields",
|
"get options.relativeTo.calendar.dateFromFields",
|
||||||
"call options.relativeTo.calendar.dateFromFields",
|
"call options.relativeTo.calendar.dateFromFields",
|
||||||
"has options.relativeTo.timeZone.timeZone",
|
|
||||||
// InterpretISODateTimeOffset
|
// InterpretISODateTimeOffset
|
||||||
"get options.relativeTo.timeZone.getPossibleInstantsFor",
|
"get options.relativeTo.timeZone.getPossibleInstantsFor",
|
||||||
"call options.relativeTo.timeZone.getPossibleInstantsFor",
|
"call options.relativeTo.timeZone.getPossibleInstantsFor",
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.duration.prototype.round
|
|
||||||
description: >
|
|
||||||
A Temporal.TimeZone instance passed to round() does not have its
|
|
||||||
'timeZone' property observably checked
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const instance = new Temporal.Duration(1);
|
|
||||||
|
|
||||||
const timeZone = new Temporal.TimeZone("UTC");
|
|
||||||
Object.defineProperty(timeZone, "timeZone", {
|
|
||||||
get() {
|
|
||||||
throw new Test262Error("timeZone.timeZone should not be accessed");
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
|
|
||||||
instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } });
|
|
@ -11,7 +11,6 @@ const instance = new Temporal.Duration(1);
|
|||||||
|
|
||||||
let timeZone = "2021-08-19T17:30";
|
let timeZone = "2021-08-19T17:30";
|
||||||
assert.throws(RangeError, () => instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), "bare date-time string is not a time zone");
|
assert.throws(RangeError, () => instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), "bare date-time string is not a time zone");
|
||||||
assert.throws(RangeError, () => instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), "bare date-time string is not a time zone");
|
|
||||||
|
|
||||||
// The following are all valid strings so should not throw:
|
// The following are all valid strings so should not throw:
|
||||||
|
|
||||||
@ -32,5 +31,4 @@ assert.throws(RangeError, () => instance.round({ largestUnit: "months", relative
|
|||||||
"2021-08-19T1730-0700[UTC]",
|
"2021-08-19T1730-0700[UTC]",
|
||||||
].forEach((timeZone) => {
|
].forEach((timeZone) => {
|
||||||
instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
|
instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
|
||||||
instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } });
|
|
||||||
});
|
});
|
||||||
|
@ -10,12 +10,10 @@ features: [Temporal]
|
|||||||
const instance = new Temporal.Duration(1);
|
const instance = new Temporal.Duration(1);
|
||||||
let timeZone = "2016-12-31T23:59:60+00:00[UTC]";
|
let timeZone = "2016-12-31T23:59:60+00:00[UTC]";
|
||||||
|
|
||||||
// A string with a leap second is a valid ISO string, so the following two
|
// A string with a leap second is a valid ISO string, so the following
|
||||||
// operations should not throw
|
// operation should not throw
|
||||||
|
|
||||||
instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
|
instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
|
||||||
instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } });
|
|
||||||
|
|
||||||
timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]";
|
timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]";
|
||||||
assert.throws(RangeError, () => instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), "leap second in time zone name not valid");
|
assert.throws(RangeError, () => instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), "leap second in time zone name not valid");
|
||||||
assert.throws(RangeError, () => instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), "leap second in time zone name not valid (nested property)");
|
|
||||||
|
@ -18,9 +18,4 @@ invalidStrings.forEach((timeZone) => {
|
|||||||
() => instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } }),
|
() => instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } }),
|
||||||
"reject minus zero as extended year"
|
"reject minus zero as extended year"
|
||||||
);
|
);
|
||||||
assert.throws(
|
|
||||||
RangeError,
|
|
||||||
() => instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }),
|
|
||||||
"reject minus zero as extended year (nested property)"
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
@ -23,7 +23,6 @@ const rangeErrorTests = [
|
|||||||
|
|
||||||
for (const [timeZone, description] of rangeErrorTests) {
|
for (const [timeZone, description] of rangeErrorTests) {
|
||||||
assert.throws(RangeError, () => instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), `${description} does not convert to a valid ISO string`);
|
assert.throws(RangeError, () => instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), `${description} does not convert to a valid ISO string`);
|
||||||
assert.throws(RangeError, () => instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), `${description} does not convert to a valid ISO string (nested property)`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
@ -32,8 +31,4 @@ const typeErrorTests = [
|
|||||||
|
|
||||||
for (const [timeZone, description] of typeErrorTests) {
|
for (const [timeZone, description] of typeErrorTests) {
|
||||||
assert.throws(TypeError, () => instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), `${description} is not a valid object and does not convert to a string`);
|
assert.throws(TypeError, () => instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), `${description} is not a valid object and does not convert to a string`);
|
||||||
assert.throws(TypeError, () => instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), `${description} is not a valid object and does not convert to a string (nested property)`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const timeZone = undefined;
|
|
||||||
assert.throws(RangeError, () => instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), `undefined is always a RangeError as nested property`);
|
|
||||||
|
@ -177,8 +177,6 @@ const expectedOpsForZonedRelativeTo = expected.concat([
|
|||||||
// InterpretTemporalDateTimeFields
|
// InterpretTemporalDateTimeFields
|
||||||
"get options.relativeTo.calendar.dateFromFields",
|
"get options.relativeTo.calendar.dateFromFields",
|
||||||
"call options.relativeTo.calendar.dateFromFields",
|
"call options.relativeTo.calendar.dateFromFields",
|
||||||
// ToRelativeTemporalObject again
|
|
||||||
"has options.relativeTo.timeZone.timeZone",
|
|
||||||
// InterpretISODateTimeOffset
|
// InterpretISODateTimeOffset
|
||||||
"get options.relativeTo.timeZone.getPossibleInstantsFor",
|
"get options.relativeTo.timeZone.getPossibleInstantsFor",
|
||||||
"call options.relativeTo.timeZone.getPossibleInstantsFor",
|
"call options.relativeTo.timeZone.getPossibleInstantsFor",
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.duration.prototype.subtract
|
|
||||||
description: >
|
|
||||||
A Temporal.TimeZone instance passed to subtract() does not have its
|
|
||||||
'timeZone' property observably checked
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const instance = new Temporal.Duration(1);
|
|
||||||
|
|
||||||
const timeZone = new Temporal.TimeZone("UTC");
|
|
||||||
Object.defineProperty(timeZone, "timeZone", {
|
|
||||||
get() {
|
|
||||||
throw new Test262Error("timeZone.timeZone should not be accessed");
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
|
|
||||||
instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } });
|
|
@ -11,7 +11,6 @@ const instance = new Temporal.Duration(1);
|
|||||||
|
|
||||||
let timeZone = "2021-08-19T17:30";
|
let timeZone = "2021-08-19T17:30";
|
||||||
assert.throws(RangeError, () => instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), "bare date-time string is not a time zone");
|
assert.throws(RangeError, () => instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), "bare date-time string is not a time zone");
|
||||||
assert.throws(RangeError, () => instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), "bare date-time string is not a time zone");
|
|
||||||
|
|
||||||
// The following are all valid strings so should not throw:
|
// The following are all valid strings so should not throw:
|
||||||
|
|
||||||
@ -32,5 +31,4 @@ assert.throws(RangeError, () => instance.subtract(new Temporal.Duration(1), { re
|
|||||||
"2021-08-19T1730-0700[UTC]",
|
"2021-08-19T1730-0700[UTC]",
|
||||||
].forEach((timeZone) => {
|
].forEach((timeZone) => {
|
||||||
instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
|
instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
|
||||||
instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } });
|
|
||||||
});
|
});
|
||||||
|
@ -10,12 +10,10 @@ features: [Temporal]
|
|||||||
const instance = new Temporal.Duration(1);
|
const instance = new Temporal.Duration(1);
|
||||||
let timeZone = "2016-12-31T23:59:60+00:00[UTC]";
|
let timeZone = "2016-12-31T23:59:60+00:00[UTC]";
|
||||||
|
|
||||||
// A string with a leap second is a valid ISO string, so the following two
|
// A string with a leap second is a valid ISO string, so the following
|
||||||
// operations should not throw
|
// operation should not throw
|
||||||
|
|
||||||
instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
|
instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
|
||||||
instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } });
|
|
||||||
|
|
||||||
timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]";
|
timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]";
|
||||||
assert.throws(RangeError, () => instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), "leap second in time zone name not valid");
|
assert.throws(RangeError, () => instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), "leap second in time zone name not valid");
|
||||||
assert.throws(RangeError, () => instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), "leap second in time zone name not valid (nested property)");
|
|
||||||
|
@ -18,9 +18,4 @@ invalidStrings.forEach((timeZone) => {
|
|||||||
() => instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }),
|
() => instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }),
|
||||||
"reject minus zero as extended year"
|
"reject minus zero as extended year"
|
||||||
);
|
);
|
||||||
assert.throws(
|
|
||||||
RangeError,
|
|
||||||
() => instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }),
|
|
||||||
"reject minus zero as extended year (nested property)"
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
@ -23,7 +23,6 @@ const rangeErrorTests = [
|
|||||||
|
|
||||||
for (const [timeZone, description] of rangeErrorTests) {
|
for (const [timeZone, description] of rangeErrorTests) {
|
||||||
assert.throws(RangeError, () => instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), `${description} does not convert to a valid ISO string`);
|
assert.throws(RangeError, () => instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), `${description} does not convert to a valid ISO string`);
|
||||||
assert.throws(RangeError, () => instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), `${description} does not convert to a valid ISO string (nested property)`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
@ -32,8 +31,4 @@ const typeErrorTests = [
|
|||||||
|
|
||||||
for (const [timeZone, description] of typeErrorTests) {
|
for (const [timeZone, description] of typeErrorTests) {
|
||||||
assert.throws(TypeError, () => instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), `${description} is not a valid object and does not convert to a string`);
|
assert.throws(TypeError, () => instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), `${description} is not a valid object and does not convert to a string`);
|
||||||
assert.throws(TypeError, () => instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), `${description} is not a valid object and does not convert to a string (nested property)`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const timeZone = undefined;
|
|
||||||
assert.throws(RangeError, () => instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), `undefined is always a RangeError as nested property`);
|
|
||||||
|
@ -183,7 +183,6 @@ const expectedOpsForZonedRelativeTo = [
|
|||||||
"call options.relativeTo.year.valueOf",
|
"call options.relativeTo.year.valueOf",
|
||||||
"get options.relativeTo.calendar.dateFromFields",
|
"get options.relativeTo.calendar.dateFromFields",
|
||||||
"call options.relativeTo.calendar.dateFromFields",
|
"call options.relativeTo.calendar.dateFromFields",
|
||||||
"has options.relativeTo.timeZone.timeZone",
|
|
||||||
// InterpretISODateTimeOffset
|
// InterpretISODateTimeOffset
|
||||||
"get options.relativeTo.timeZone.getPossibleInstantsFor",
|
"get options.relativeTo.timeZone.getPossibleInstantsFor",
|
||||||
"call options.relativeTo.timeZone.getPossibleInstantsFor",
|
"call options.relativeTo.timeZone.getPossibleInstantsFor",
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.duration.prototype.total
|
|
||||||
description: >
|
|
||||||
A Temporal.TimeZone instance passed to total() does not have its
|
|
||||||
'timeZone' property observably checked
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const instance = new Temporal.Duration(1);
|
|
||||||
|
|
||||||
const timeZone = new Temporal.TimeZone("UTC");
|
|
||||||
Object.defineProperty(timeZone, "timeZone", {
|
|
||||||
get() {
|
|
||||||
throw new Test262Error("timeZone.timeZone should not be accessed");
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
|
|
||||||
instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } });
|
|
@ -11,7 +11,6 @@ const instance = new Temporal.Duration(1);
|
|||||||
|
|
||||||
let timeZone = "2021-08-19T17:30";
|
let timeZone = "2021-08-19T17:30";
|
||||||
assert.throws(RangeError, () => instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), "bare date-time string is not a time zone");
|
assert.throws(RangeError, () => instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), "bare date-time string is not a time zone");
|
||||||
assert.throws(RangeError, () => instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), "bare date-time string is not a time zone");
|
|
||||||
|
|
||||||
// The following are all valid strings so should not throw:
|
// The following are all valid strings so should not throw:
|
||||||
|
|
||||||
@ -32,5 +31,4 @@ assert.throws(RangeError, () => instance.total({ unit: "months", relativeTo: { y
|
|||||||
"2021-08-19T1730-0700[UTC]",
|
"2021-08-19T1730-0700[UTC]",
|
||||||
].forEach((timeZone) => {
|
].forEach((timeZone) => {
|
||||||
instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
|
instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
|
||||||
instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } });
|
|
||||||
});
|
});
|
||||||
|
@ -10,12 +10,10 @@ features: [Temporal]
|
|||||||
const instance = new Temporal.Duration(1);
|
const instance = new Temporal.Duration(1);
|
||||||
let timeZone = "2016-12-31T23:59:60+00:00[UTC]";
|
let timeZone = "2016-12-31T23:59:60+00:00[UTC]";
|
||||||
|
|
||||||
// A string with a leap second is a valid ISO string, so the following two
|
// A string with a leap second is a valid ISO string, so the following
|
||||||
// operations should not throw
|
// operation should not throw
|
||||||
|
|
||||||
instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
|
instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
|
||||||
instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } });
|
|
||||||
|
|
||||||
timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]";
|
timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]";
|
||||||
assert.throws(RangeError, () => instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), "leap second in time zone name not valid");
|
assert.throws(RangeError, () => instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), "leap second in time zone name not valid");
|
||||||
assert.throws(RangeError, () => instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), "leap second in time zone name not valid (nested property)");
|
|
||||||
|
@ -18,9 +18,4 @@ invalidStrings.forEach((timeZone) => {
|
|||||||
() => instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } }),
|
() => instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } }),
|
||||||
"reject minus zero as extended year"
|
"reject minus zero as extended year"
|
||||||
);
|
);
|
||||||
assert.throws(
|
|
||||||
RangeError,
|
|
||||||
() => instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }),
|
|
||||||
"reject minus zero as extended year (nested property)"
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
@ -23,7 +23,6 @@ const rangeErrorTests = [
|
|||||||
|
|
||||||
for (const [timeZone, description] of rangeErrorTests) {
|
for (const [timeZone, description] of rangeErrorTests) {
|
||||||
assert.throws(RangeError, () => instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), `${description} does not convert to a valid ISO string`);
|
assert.throws(RangeError, () => instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), `${description} does not convert to a valid ISO string`);
|
||||||
assert.throws(RangeError, () => instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), `${description} does not convert to a valid ISO string (nested property)`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
@ -32,8 +31,4 @@ const typeErrorTests = [
|
|||||||
|
|
||||||
for (const [timeZone, description] of typeErrorTests) {
|
for (const [timeZone, description] of typeErrorTests) {
|
||||||
assert.throws(TypeError, () => instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), `${description} is not a valid object and does not convert to a string`);
|
assert.throws(TypeError, () => instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), `${description} is not a valid object and does not convert to a string`);
|
||||||
assert.throws(TypeError, () => instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), `${description} is not a valid object and does not convert to a string (nested property)`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const timeZone = undefined;
|
|
||||||
assert.throws(RangeError, () => instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), `undefined is always a RangeError as nested property`);
|
|
||||||
|
@ -19,7 +19,6 @@ const expected = [
|
|||||||
"get options.smallestUnit.toString",
|
"get options.smallestUnit.toString",
|
||||||
"call options.smallestUnit.toString",
|
"call options.smallestUnit.toString",
|
||||||
"get options.timeZone",
|
"get options.timeZone",
|
||||||
"has options.timeZone.timeZone",
|
|
||||||
"get options.timeZone.getOffsetNanosecondsFor",
|
"get options.timeZone.getOffsetNanosecondsFor",
|
||||||
"call options.timeZone.getOffsetNanosecondsFor",
|
"call options.timeZone.getOffsetNanosecondsFor",
|
||||||
"get options.timeZone.getOffsetNanosecondsFor",
|
"get options.timeZone.getOffsetNanosecondsFor",
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.instant.prototype.tostring
|
|
||||||
description: >
|
|
||||||
A Temporal.TimeZone instance passed to toString() does not have its
|
|
||||||
'timeZone' property observably checked
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const instance = new Temporal.Instant(0n);
|
|
||||||
|
|
||||||
const timeZone = new Temporal.TimeZone("UTC");
|
|
||||||
Object.defineProperty(timeZone, "timeZone", {
|
|
||||||
get() {
|
|
||||||
throw new Test262Error("timeZone.timeZone should not be accessed");
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
instance.toString({ timeZone });
|
|
||||||
instance.toString({ timeZone: { timeZone } });
|
|
@ -11,34 +11,23 @@ const instance = new Temporal.Instant(0n);
|
|||||||
|
|
||||||
let timeZone = "2021-08-19T17:30";
|
let timeZone = "2021-08-19T17:30";
|
||||||
assert.throws(RangeError, () => instance.toString({ timeZone }), "bare date-time string is not a time zone");
|
assert.throws(RangeError, () => instance.toString({ timeZone }), "bare date-time string is not a time zone");
|
||||||
assert.throws(RangeError, () => instance.toString({ timeZone: { timeZone } }), "bare date-time string is not a time zone");
|
|
||||||
|
|
||||||
timeZone = "2021-08-19T17:30Z";
|
timeZone = "2021-08-19T17:30Z";
|
||||||
const result1 = instance.toString({ timeZone });
|
const result1 = instance.toString({ timeZone });
|
||||||
assert.sameValue(result1.substr(-6), "+00:00", "date-time + Z is UTC time zone");
|
assert.sameValue(result1.substr(-6), "+00:00", "date-time + Z is UTC time zone");
|
||||||
const result2 = instance.toString({ timeZone: { timeZone } });
|
|
||||||
assert.sameValue(result2.substr(-6), "+00:00", "date-time + Z is UTC time zone (string in property bag)");
|
|
||||||
|
|
||||||
timeZone = "2021-08-19T17:30-07:00";
|
timeZone = "2021-08-19T17:30-07:00";
|
||||||
const result3 = instance.toString({ timeZone });
|
const result2 = instance.toString({ timeZone });
|
||||||
assert.sameValue(result3.substr(-6), "-07:00", "date-time + offset is the offset time zone");
|
assert.sameValue(result2.substr(-6), "-07:00", "date-time + offset is the offset time zone");
|
||||||
const result4 = instance.toString({ timeZone: { timeZone } });
|
|
||||||
assert.sameValue(result4.substr(-6), "-07:00", "date-time + offset is the offset time zone (string in property bag)");
|
|
||||||
|
|
||||||
timeZone = "2021-08-19T17:30[UTC]";
|
timeZone = "2021-08-19T17:30[UTC]";
|
||||||
const result5 = instance.toString({ timeZone });
|
const result3 = instance.toString({ timeZone });
|
||||||
assert.sameValue(result5.substr(-6), "+00:00", "date-time + IANA annotation is the offset time zone");
|
assert.sameValue(result3.substr(-6), "+00:00", "date-time + IANA annotation is the offset time zone");
|
||||||
const result6 = instance.toString({ timeZone: { timeZone } });
|
|
||||||
assert.sameValue(result6.substr(-6), "+00:00", "date-time + IANA annotation is the offset time zone (string in property bag)");
|
|
||||||
|
|
||||||
timeZone = "2021-08-19T17:30Z[UTC]";
|
timeZone = "2021-08-19T17:30Z[UTC]";
|
||||||
const result7 = instance.toString({ timeZone });
|
const result4 = instance.toString({ timeZone });
|
||||||
assert.sameValue(result7.substr(-6), "+00:00", "date-time + Z + IANA annotation is the offset time zone");
|
assert.sameValue(result4.substr(-6), "+00:00", "date-time + Z + IANA annotation is the offset time zone");
|
||||||
const result8 = instance.toString({ timeZone: { timeZone } });
|
|
||||||
assert.sameValue(result8.substr(-6), "+00:00", "date-time + Z + IANA annotation is the offset time zone (string in property bag)");
|
|
||||||
|
|
||||||
timeZone = "2021-08-19T17:30-07:00[UTC]";
|
timeZone = "2021-08-19T17:30-07:00[UTC]";
|
||||||
const result9 = instance.toString({ timeZone });
|
const result5 = instance.toString({ timeZone });
|
||||||
assert.sameValue(result9.substr(-6), "+00:00", "date-time + offset + IANA annotation is the offset time zone");
|
assert.sameValue(result5.substr(-6), "+00:00", "date-time + offset + IANA annotation is the offset time zone");
|
||||||
const result10 = instance.toString({ timeZone: { timeZone } });
|
|
||||||
assert.sameValue(result10.substr(-6), "+00:00", "date-time + offset + IANA annotation is the offset time zone (string in property bag)");
|
|
||||||
|
@ -10,11 +10,8 @@ features: [Temporal]
|
|||||||
const instance = new Temporal.Instant(0n);
|
const instance = new Temporal.Instant(0n);
|
||||||
let timeZone = "2016-12-31T23:59:60+00:00[UTC]";
|
let timeZone = "2016-12-31T23:59:60+00:00[UTC]";
|
||||||
|
|
||||||
const result1 = instance.toString({ timeZone });
|
const result = instance.toString({ timeZone });
|
||||||
assert.sameValue(result1.substr(-6), "+00:00", "leap second is a valid ISO string for TimeZone");
|
assert.sameValue(result.substr(-6), "+00:00", "leap second is a valid ISO string for TimeZone");
|
||||||
const result2 = instance.toString({ timeZone: { timeZone } });
|
|
||||||
assert.sameValue(result2.substr(-6), "+00:00", "leap second is a valid ISO string for TimeZone (nested property)");
|
|
||||||
|
|
||||||
timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]";
|
timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]";
|
||||||
assert.throws(RangeError, () => instance.toString({ timeZone }), "leap second in time zone name not valid");
|
assert.throws(RangeError, () => instance.toString({ timeZone }), "leap second in time zone name not valid");
|
||||||
assert.throws(RangeError, () => instance.toString({ timeZone: { timeZone } }), "leap second in time zone name not valid (nested property)");
|
|
||||||
|
@ -10,7 +10,5 @@ features: [Temporal]
|
|||||||
const instance = new Temporal.Instant(0n);
|
const instance = new Temporal.Instant(0n);
|
||||||
const timeZone = "2021-08-19T17:30:45.123456789+01:46[+01:45:30.987654321]";
|
const timeZone = "2021-08-19T17:30:45.123456789+01:46[+01:45:30.987654321]";
|
||||||
|
|
||||||
const result1 = instance.toString({ timeZone });
|
const result = instance.toString({ timeZone });
|
||||||
assert.sameValue(result1.substr(-6), "+01:46", "Time zone string determined from offset");
|
assert.sameValue(result.substr(-6), "+01:46", "Time zone string determined from offset");
|
||||||
const result2 = instance.toString({ timeZone: { timeZone } });
|
|
||||||
assert.sameValue(result2.substr(-6), "+01:46", "Time zone string determined from offset");
|
|
||||||
|
@ -18,9 +18,4 @@ invalidStrings.forEach((timeZone) => {
|
|||||||
() => instance.toString({ timeZone }),
|
() => instance.toString({ timeZone }),
|
||||||
"reject minus zero as extended year"
|
"reject minus zero as extended year"
|
||||||
);
|
);
|
||||||
assert.throws(
|
|
||||||
RangeError,
|
|
||||||
() => instance.toString({ timeZone: { timeZone } }),
|
|
||||||
"reject minus zero as extended year (nested property)"
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
@ -23,7 +23,6 @@ const rangeErrorTests = [
|
|||||||
|
|
||||||
for (const [timeZone, description] of rangeErrorTests) {
|
for (const [timeZone, description] of rangeErrorTests) {
|
||||||
assert.throws(RangeError, () => instance.toString({ timeZone }), `${description} does not convert to a valid ISO string`);
|
assert.throws(RangeError, () => instance.toString({ timeZone }), `${description} does not convert to a valid ISO string`);
|
||||||
assert.throws(RangeError, () => instance.toString({ timeZone: { timeZone } }), `${description} does not convert to a valid ISO string (nested property)`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
@ -32,8 +31,4 @@ const typeErrorTests = [
|
|||||||
|
|
||||||
for (const [timeZone, description] of typeErrorTests) {
|
for (const [timeZone, description] of typeErrorTests) {
|
||||||
assert.throws(TypeError, () => instance.toString({ timeZone }), `${description} is not a valid object and does not convert to a string`);
|
assert.throws(TypeError, () => instance.toString({ timeZone }), `${description} is not a valid object and does not convert to a string`);
|
||||||
assert.throws(TypeError, () => instance.toString({ timeZone: { timeZone } }), `${description} is not a valid object and does not convert to a string (nested property)`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const timeZone = undefined;
|
|
||||||
assert.throws(RangeError, () => instance.toString({ timeZone: { timeZone } }), `undefined is always a RangeError as nested property`);
|
|
||||||
|
@ -10,7 +10,6 @@ features: [Temporal]
|
|||||||
|
|
||||||
const actual = [];
|
const actual = [];
|
||||||
const expected = [
|
const expected = [
|
||||||
"has timeZone.timeZone",
|
|
||||||
"get timeZone.getOffsetNanosecondsFor",
|
"get timeZone.getOffsetNanosecondsFor",
|
||||||
"call timeZone.getOffsetNanosecondsFor",
|
"call timeZone.getOffsetNanosecondsFor",
|
||||||
"get timeZone.getOffsetNanosecondsFor",
|
"get timeZone.getOffsetNanosecondsFor",
|
||||||
|
@ -9,9 +9,6 @@ features: [Temporal]
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
const actual = [];
|
const actual = [];
|
||||||
const expected = [
|
|
||||||
"has timeZone.timeZone",
|
|
||||||
];
|
|
||||||
|
|
||||||
const instant = Temporal.Instant.from("1975-02-02T14:25:36.123456789Z");
|
const instant = Temporal.Instant.from("1975-02-02T14:25:36.123456789Z");
|
||||||
const calendar = Temporal.Calendar.from("iso8601");
|
const calendar = Temporal.Calendar.from("iso8601");
|
||||||
@ -22,4 +19,4 @@ const timeZone = TemporalHelpers.timeZoneObserver(actual, "timeZone", {
|
|||||||
const result = instant.toZonedDateTime({ timeZone, calendar });
|
const result = instant.toZonedDateTime({ timeZone, calendar });
|
||||||
assert.sameValue(result.epochNanoseconds, instant.epochNanoseconds);
|
assert.sameValue(result.epochNanoseconds, instant.epochNanoseconds);
|
||||||
|
|
||||||
assert.compareArray(actual, expected);
|
assert.compareArray(actual, []);
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.instant.prototype.tozoneddatetime
|
|
||||||
description: >
|
|
||||||
A Temporal.TimeZone instance passed to toZonedDateTime() does not have its
|
|
||||||
'timeZone' property observably checked
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const instance = new Temporal.Instant(0n);
|
|
||||||
|
|
||||||
const timeZone = new Temporal.TimeZone("UTC");
|
|
||||||
Object.defineProperty(timeZone, "timeZone", {
|
|
||||||
get() {
|
|
||||||
throw new Test262Error("timeZone.timeZone should not be accessed");
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
instance.toZonedDateTime({ timeZone, calendar: "iso8601" });
|
|
||||||
instance.toZonedDateTime({ timeZone: { timeZone }, calendar: "iso8601" });
|
|
@ -11,34 +11,23 @@ const instance = new Temporal.Instant(0n);
|
|||||||
|
|
||||||
let timeZone = "2021-08-19T17:30";
|
let timeZone = "2021-08-19T17:30";
|
||||||
assert.throws(RangeError, () => instance.toZonedDateTime({ timeZone, calendar: "iso8601" }), "bare date-time string is not a time zone");
|
assert.throws(RangeError, () => instance.toZonedDateTime({ timeZone, calendar: "iso8601" }), "bare date-time string is not a time zone");
|
||||||
assert.throws(RangeError, () => instance.toZonedDateTime({ timeZone: { timeZone }, calendar: "iso8601" }), "bare date-time string is not a time zone");
|
|
||||||
|
|
||||||
timeZone = "2021-08-19T17:30Z";
|
timeZone = "2021-08-19T17:30Z";
|
||||||
const result1 = instance.toZonedDateTime({ timeZone, calendar: "iso8601" });
|
const result1 = instance.toZonedDateTime({ timeZone, calendar: "iso8601" });
|
||||||
assert.sameValue(result1.timeZoneId, "UTC", "date-time + Z is UTC time zone");
|
assert.sameValue(result1.timeZoneId, "UTC", "date-time + Z is UTC time zone");
|
||||||
const result2 = instance.toZonedDateTime({ timeZone: { timeZone }, calendar: "iso8601" });
|
|
||||||
assert.sameValue(result2.timeZoneId, "UTC", "date-time + Z is UTC time zone (string in property bag)");
|
|
||||||
|
|
||||||
timeZone = "2021-08-19T17:30-07:00";
|
timeZone = "2021-08-19T17:30-07:00";
|
||||||
const result3 = instance.toZonedDateTime({ timeZone, calendar: "iso8601" });
|
const result2 = instance.toZonedDateTime({ timeZone, calendar: "iso8601" });
|
||||||
assert.sameValue(result3.timeZoneId, "-07:00", "date-time + offset is the offset time zone");
|
assert.sameValue(result2.timeZoneId, "-07:00", "date-time + offset is the offset time zone");
|
||||||
const result4 = instance.toZonedDateTime({ timeZone: { timeZone }, calendar: "iso8601" });
|
|
||||||
assert.sameValue(result4.timeZoneId, "-07:00", "date-time + offset is the offset time zone (string in property bag)");
|
|
||||||
|
|
||||||
timeZone = "2021-08-19T17:30[UTC]";
|
timeZone = "2021-08-19T17:30[UTC]";
|
||||||
const result5 = instance.toZonedDateTime({ timeZone, calendar: "iso8601" });
|
const result3 = instance.toZonedDateTime({ timeZone, calendar: "iso8601" });
|
||||||
assert.sameValue(result5.timeZoneId, "UTC", "date-time + IANA annotation is the IANA time zone");
|
assert.sameValue(result3.timeZoneId, "UTC", "date-time + IANA annotation is the IANA time zone");
|
||||||
const result6 = instance.toZonedDateTime({ timeZone: { timeZone }, calendar: "iso8601" });
|
|
||||||
assert.sameValue(result6.timeZoneId, "UTC", "date-time + IANA annotation is the IANA time zone (string in property bag)");
|
|
||||||
|
|
||||||
timeZone = "2021-08-19T17:30Z[UTC]";
|
timeZone = "2021-08-19T17:30Z[UTC]";
|
||||||
const result7 = instance.toZonedDateTime({ timeZone, calendar: "iso8601" });
|
const result4 = instance.toZonedDateTime({ timeZone, calendar: "iso8601" });
|
||||||
assert.sameValue(result7.timeZoneId, "UTC", "date-time + Z + IANA annotation is the IANA time zone");
|
assert.sameValue(result4.timeZoneId, "UTC", "date-time + Z + IANA annotation is the IANA time zone");
|
||||||
const result8 = instance.toZonedDateTime({ timeZone: { timeZone }, calendar: "iso8601" });
|
|
||||||
assert.sameValue(result8.timeZoneId, "UTC", "date-time + Z + IANA annotation is the IANA time zone (string in property bag)");
|
|
||||||
|
|
||||||
timeZone = "2021-08-19T17:30-07:00[UTC]";
|
timeZone = "2021-08-19T17:30-07:00[UTC]";
|
||||||
const result9 = instance.toZonedDateTime({ timeZone, calendar: "iso8601" });
|
const result5 = instance.toZonedDateTime({ timeZone, calendar: "iso8601" });
|
||||||
assert.sameValue(result9.timeZoneId, "UTC", "date-time + offset + IANA annotation is the IANA time zone");
|
assert.sameValue(result5.timeZoneId, "UTC", "date-time + offset + IANA annotation is the IANA time zone");
|
||||||
const result10 = instance.toZonedDateTime({ timeZone: { timeZone }, calendar: "iso8601" });
|
|
||||||
assert.sameValue(result10.timeZoneId, "UTC", "date-time + offset + IANA annotation is the IANA time zone (string in property bag)");
|
|
||||||
|
@ -10,11 +10,8 @@ features: [Temporal]
|
|||||||
const instance = new Temporal.Instant(0n);
|
const instance = new Temporal.Instant(0n);
|
||||||
let timeZone = "2016-12-31T23:59:60+00:00[UTC]";
|
let timeZone = "2016-12-31T23:59:60+00:00[UTC]";
|
||||||
|
|
||||||
const result1 = instance.toZonedDateTime({ timeZone, calendar: "iso8601" });
|
const result = instance.toZonedDateTime({ timeZone, calendar: "iso8601" });
|
||||||
assert.sameValue(result1.timeZoneId, "UTC", "leap second is a valid ISO string for TimeZone");
|
assert.sameValue(result.timeZoneId, "UTC", "leap second is a valid ISO string for TimeZone");
|
||||||
const result2 = instance.toZonedDateTime({ timeZone: { timeZone }, calendar: "iso8601" });
|
|
||||||
assert.sameValue(result2.timeZoneId, "UTC", "leap second is a valid ISO string for TimeZone (nested property)");
|
|
||||||
|
|
||||||
timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]";
|
timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]";
|
||||||
assert.throws(RangeError, () => instance.toZonedDateTime({ timeZone, calendar: "iso8601" }), "leap second in time zone name not valid");
|
assert.throws(RangeError, () => instance.toZonedDateTime({ timeZone, calendar: "iso8601" }), "leap second in time zone name not valid");
|
||||||
assert.throws(RangeError, () => instance.toZonedDateTime({ timeZone: { timeZone }, calendar: "iso8601" }), "leap second in time zone name not valid (nested property)");
|
|
||||||
|
@ -10,7 +10,5 @@ features: [Temporal]
|
|||||||
const instance = new Temporal.Instant(0n);
|
const instance = new Temporal.Instant(0n);
|
||||||
const timeZone = "2021-08-19T17:30:45.123456789+01:46[+01:45:30.987654321]";
|
const timeZone = "2021-08-19T17:30:45.123456789+01:46[+01:45:30.987654321]";
|
||||||
|
|
||||||
const result1 = instance.toZonedDateTime({ timeZone, calendar: "iso8601" });
|
const result = instance.toZonedDateTime({ timeZone, calendar: "iso8601" });
|
||||||
assert.sameValue(result1.timeZoneId, "+01:45:30.987654321", "Time zone string determined from bracket name");
|
assert.sameValue(result.timeZoneId, "+01:45:30.987654321", "Time zone string determined from bracket name");
|
||||||
const result2 = instance.toZonedDateTime({ timeZone: { timeZone }, calendar: "iso8601" });
|
|
||||||
assert.sameValue(result2.timeZoneId, "+01:45:30.987654321", "Time zone string determined from bracket name");
|
|
||||||
|
@ -18,9 +18,4 @@ invalidStrings.forEach((timeZone) => {
|
|||||||
() => instance.toZonedDateTime({ timeZone, calendar: "iso8601" }),
|
() => instance.toZonedDateTime({ timeZone, calendar: "iso8601" }),
|
||||||
"reject minus zero as extended year"
|
"reject minus zero as extended year"
|
||||||
);
|
);
|
||||||
assert.throws(
|
|
||||||
RangeError,
|
|
||||||
() => instance.toZonedDateTime({ timeZone: { timeZone }, calendar: "iso8601" }),
|
|
||||||
"reject minus zero as extended year (nested property)"
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
@ -23,7 +23,6 @@ const rangeErrorTests = [
|
|||||||
|
|
||||||
for (const [timeZone, description] of rangeErrorTests) {
|
for (const [timeZone, description] of rangeErrorTests) {
|
||||||
assert.throws(RangeError, () => instance.toZonedDateTime({ timeZone, calendar: "iso8601" }), `${description} does not convert to a valid ISO string`);
|
assert.throws(RangeError, () => instance.toZonedDateTime({ timeZone, calendar: "iso8601" }), `${description} does not convert to a valid ISO string`);
|
||||||
assert.throws(RangeError, () => instance.toZonedDateTime({ timeZone: { timeZone }, calendar: "iso8601" }), `${description} does not convert to a valid ISO string (nested property)`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
@ -32,8 +31,4 @@ const typeErrorTests = [
|
|||||||
|
|
||||||
for (const [timeZone, description] of typeErrorTests) {
|
for (const [timeZone, description] of typeErrorTests) {
|
||||||
assert.throws(TypeError, () => instance.toZonedDateTime({ timeZone, calendar: "iso8601" }), `${description} is not a valid object and does not convert to a string`);
|
assert.throws(TypeError, () => instance.toZonedDateTime({ timeZone, calendar: "iso8601" }), `${description} is not a valid object and does not convert to a string`);
|
||||||
assert.throws(TypeError, () => instance.toZonedDateTime({ timeZone: { timeZone }, calendar: "iso8601" }), `${description} is not a valid object and does not convert to a string (nested property)`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const timeZone = undefined;
|
|
||||||
assert.throws(RangeError, () => instance.toZonedDateTime({ timeZone: { timeZone }, calendar: "iso8601" }), `undefined is always a RangeError as nested property`);
|
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.instant.prototype.tozoneddatetimeiso
|
|
||||||
description: >
|
|
||||||
A Temporal.TimeZone instance passed to toZonedDateTimeISO() does not have its
|
|
||||||
'timeZone' property observably checked
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const instance = new Temporal.Instant(0n);
|
|
||||||
|
|
||||||
const timeZone = new Temporal.TimeZone("UTC");
|
|
||||||
Object.defineProperty(timeZone, "timeZone", {
|
|
||||||
get() {
|
|
||||||
throw new Test262Error("timeZone.timeZone should not be accessed");
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
instance.toZonedDateTimeISO(timeZone);
|
|
||||||
instance.toZonedDateTimeISO({ timeZone });
|
|
@ -11,34 +11,23 @@ const instance = new Temporal.Instant(0n);
|
|||||||
|
|
||||||
let timeZone = "2021-08-19T17:30";
|
let timeZone = "2021-08-19T17:30";
|
||||||
assert.throws(RangeError, () => instance.toZonedDateTimeISO(timeZone), "bare date-time string is not a time zone");
|
assert.throws(RangeError, () => instance.toZonedDateTimeISO(timeZone), "bare date-time string is not a time zone");
|
||||||
assert.throws(RangeError, () => instance.toZonedDateTimeISO({ timeZone }), "bare date-time string is not a time zone");
|
|
||||||
|
|
||||||
timeZone = "2021-08-19T17:30Z";
|
timeZone = "2021-08-19T17:30Z";
|
||||||
const result1 = instance.toZonedDateTimeISO(timeZone);
|
const result1 = instance.toZonedDateTimeISO(timeZone);
|
||||||
assert.sameValue(result1.timeZoneId, "UTC", "date-time + Z is UTC time zone");
|
assert.sameValue(result1.timeZoneId, "UTC", "date-time + Z is UTC time zone");
|
||||||
const result2 = instance.toZonedDateTimeISO({ timeZone });
|
|
||||||
assert.sameValue(result2.timeZoneId, "UTC", "date-time + Z is UTC time zone (string in property bag)");
|
|
||||||
|
|
||||||
timeZone = "2021-08-19T17:30-07:00";
|
timeZone = "2021-08-19T17:30-07:00";
|
||||||
const result3 = instance.toZonedDateTimeISO(timeZone);
|
const result2 = instance.toZonedDateTimeISO(timeZone);
|
||||||
assert.sameValue(result3.timeZoneId, "-07:00", "date-time + offset is the offset time zone");
|
assert.sameValue(result2.timeZoneId, "-07:00", "date-time + offset is the offset time zone");
|
||||||
const result4 = instance.toZonedDateTimeISO({ timeZone });
|
|
||||||
assert.sameValue(result4.timeZoneId, "-07:00", "date-time + offset is the offset time zone (string in property bag)");
|
|
||||||
|
|
||||||
timeZone = "2021-08-19T17:30[UTC]";
|
timeZone = "2021-08-19T17:30[UTC]";
|
||||||
const result5 = instance.toZonedDateTimeISO(timeZone);
|
const result3 = instance.toZonedDateTimeISO(timeZone);
|
||||||
assert.sameValue(result5.timeZoneId, "UTC", "date-time + IANA annotation is the IANA time zone");
|
assert.sameValue(result3.timeZoneId, "UTC", "date-time + IANA annotation is the IANA time zone");
|
||||||
const result6 = instance.toZonedDateTimeISO({ timeZone });
|
|
||||||
assert.sameValue(result6.timeZoneId, "UTC", "date-time + IANA annotation is the IANA time zone (string in property bag)");
|
|
||||||
|
|
||||||
timeZone = "2021-08-19T17:30Z[UTC]";
|
timeZone = "2021-08-19T17:30Z[UTC]";
|
||||||
const result7 = instance.toZonedDateTimeISO(timeZone);
|
const result4 = instance.toZonedDateTimeISO(timeZone);
|
||||||
assert.sameValue(result7.timeZoneId, "UTC", "date-time + Z + IANA annotation is the IANA time zone");
|
assert.sameValue(result4.timeZoneId, "UTC", "date-time + Z + IANA annotation is the IANA time zone");
|
||||||
const result8 = instance.toZonedDateTimeISO({ timeZone });
|
|
||||||
assert.sameValue(result8.timeZoneId, "UTC", "date-time + Z + IANA annotation is the IANA time zone (string in property bag)");
|
|
||||||
|
|
||||||
timeZone = "2021-08-19T17:30-07:00[UTC]";
|
timeZone = "2021-08-19T17:30-07:00[UTC]";
|
||||||
const result9 = instance.toZonedDateTimeISO(timeZone);
|
const result5 = instance.toZonedDateTimeISO(timeZone);
|
||||||
assert.sameValue(result9.timeZoneId, "UTC", "date-time + offset + IANA annotation is the IANA time zone");
|
assert.sameValue(result5.timeZoneId, "UTC", "date-time + offset + IANA annotation is the IANA time zone");
|
||||||
const result10 = instance.toZonedDateTimeISO({ timeZone });
|
|
||||||
assert.sameValue(result10.timeZoneId, "UTC", "date-time + offset + IANA annotation is the IANA time zone (string in property bag)");
|
|
||||||
|
@ -10,11 +10,8 @@ features: [Temporal]
|
|||||||
const instance = new Temporal.Instant(0n);
|
const instance = new Temporal.Instant(0n);
|
||||||
let timeZone = "2016-12-31T23:59:60+00:00[UTC]";
|
let timeZone = "2016-12-31T23:59:60+00:00[UTC]";
|
||||||
|
|
||||||
const result1 = instance.toZonedDateTimeISO(timeZone);
|
const result = instance.toZonedDateTimeISO(timeZone);
|
||||||
assert.sameValue(result1.timeZoneId, "UTC", "leap second is a valid ISO string for TimeZone");
|
assert.sameValue(result.timeZoneId, "UTC", "leap second is a valid ISO string for TimeZone");
|
||||||
const result2 = instance.toZonedDateTimeISO({ timeZone });
|
|
||||||
assert.sameValue(result2.timeZoneId, "UTC", "leap second is a valid ISO string for TimeZone (nested property)");
|
|
||||||
|
|
||||||
timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]";
|
timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]";
|
||||||
assert.throws(RangeError, () => instance.toZonedDateTimeISO(timeZone), "leap second in time zone name not valid");
|
assert.throws(RangeError, () => instance.toZonedDateTimeISO(timeZone), "leap second in time zone name not valid");
|
||||||
assert.throws(RangeError, () => instance.toZonedDateTimeISO({ timeZone }), "leap second in time zone name not valid (nested property)");
|
|
||||||
|
@ -10,7 +10,5 @@ features: [Temporal]
|
|||||||
const instance = new Temporal.Instant(0n);
|
const instance = new Temporal.Instant(0n);
|
||||||
const timeZone = "2021-08-19T17:30:45.123456789+01:46[+01:45:30.987654321]";
|
const timeZone = "2021-08-19T17:30:45.123456789+01:46[+01:45:30.987654321]";
|
||||||
|
|
||||||
const result1 = instance.toZonedDateTimeISO(timeZone);
|
const result = instance.toZonedDateTimeISO(timeZone);
|
||||||
assert.sameValue(result1.timeZoneId, "+01:45:30.987654321", "Time zone string determined from bracket name");
|
assert.sameValue(result.timeZoneId, "+01:45:30.987654321", "Time zone string determined from bracket name");
|
||||||
const result2 = instance.toZonedDateTimeISO({ timeZone });
|
|
||||||
assert.sameValue(result2.timeZoneId, "+01:45:30.987654321", "Time zone string determined from bracket name");
|
|
||||||
|
@ -18,9 +18,4 @@ invalidStrings.forEach((timeZone) => {
|
|||||||
() => instance.toZonedDateTimeISO(timeZone),
|
() => instance.toZonedDateTimeISO(timeZone),
|
||||||
"reject minus zero as extended year"
|
"reject minus zero as extended year"
|
||||||
);
|
);
|
||||||
assert.throws(
|
|
||||||
RangeError,
|
|
||||||
() => instance.toZonedDateTimeISO({ timeZone }),
|
|
||||||
"reject minus zero as extended year (nested property)"
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
@ -23,7 +23,6 @@ const rangeErrorTests = [
|
|||||||
|
|
||||||
for (const [timeZone, description] of rangeErrorTests) {
|
for (const [timeZone, description] of rangeErrorTests) {
|
||||||
assert.throws(RangeError, () => instance.toZonedDateTimeISO(timeZone), `${description} does not convert to a valid ISO string`);
|
assert.throws(RangeError, () => instance.toZonedDateTimeISO(timeZone), `${description} does not convert to a valid ISO string`);
|
||||||
assert.throws(RangeError, () => instance.toZonedDateTimeISO({ timeZone }), `${description} does not convert to a valid ISO string (nested property)`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
@ -32,8 +31,4 @@ const typeErrorTests = [
|
|||||||
|
|
||||||
for (const [timeZone, description] of typeErrorTests) {
|
for (const [timeZone, description] of typeErrorTests) {
|
||||||
assert.throws(TypeError, () => instance.toZonedDateTimeISO(timeZone), `${description} is not a valid object and does not convert to a string`);
|
assert.throws(TypeError, () => instance.toZonedDateTimeISO(timeZone), `${description} is not a valid object and does not convert to a string`);
|
||||||
assert.throws(TypeError, () => instance.toZonedDateTimeISO({ timeZone }), `${description} is not a valid object and does not convert to a string (nested property)`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const timeZone = undefined;
|
|
||||||
assert.throws(RangeError, () => instance.toZonedDateTimeISO({ timeZone }), `undefined is always a RangeError as nested property`);
|
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.now.plaindate
|
|
||||||
description: >
|
|
||||||
A Temporal.TimeZone instance passed to plainDate() does not have its
|
|
||||||
'timeZone' property observably checked
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const timeZone = new Temporal.TimeZone("UTC");
|
|
||||||
Object.defineProperty(timeZone, "timeZone", {
|
|
||||||
get() {
|
|
||||||
throw new Test262Error("timeZone.timeZone should not be accessed");
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
Temporal.Now.plainDate("iso8601", timeZone);
|
|
||||||
Temporal.Now.plainDate("iso8601", { timeZone });
|
|
@ -9,7 +9,6 @@ features: [Temporal]
|
|||||||
|
|
||||||
let timeZone = "2021-08-19T17:30";
|
let timeZone = "2021-08-19T17:30";
|
||||||
assert.throws(RangeError, () => Temporal.Now.plainDate("iso8601", timeZone), "bare date-time string is not a time zone");
|
assert.throws(RangeError, () => Temporal.Now.plainDate("iso8601", timeZone), "bare date-time string is not a time zone");
|
||||||
assert.throws(RangeError, () => Temporal.Now.plainDate("iso8601", { timeZone }), "bare date-time string is not a time zone");
|
|
||||||
|
|
||||||
// The following are all valid strings so should not throw:
|
// The following are all valid strings so should not throw:
|
||||||
|
|
||||||
@ -30,5 +29,4 @@ assert.throws(RangeError, () => Temporal.Now.plainDate("iso8601", { timeZone }),
|
|||||||
"2021-08-19T1730-0700[UTC]",
|
"2021-08-19T1730-0700[UTC]",
|
||||||
].forEach((timeZone) => {
|
].forEach((timeZone) => {
|
||||||
Temporal.Now.plainDate("iso8601", timeZone);
|
Temporal.Now.plainDate("iso8601", timeZone);
|
||||||
Temporal.Now.plainDate("iso8601", { timeZone });
|
|
||||||
});
|
});
|
||||||
|
@ -9,12 +9,10 @@ features: [Temporal]
|
|||||||
|
|
||||||
let timeZone = "2016-12-31T23:59:60+00:00[UTC]";
|
let timeZone = "2016-12-31T23:59:60+00:00[UTC]";
|
||||||
|
|
||||||
// A string with a leap second is a valid ISO string, so the following two
|
// A string with a leap second is a valid ISO string, so the following
|
||||||
// operations should not throw
|
// operation should not throw
|
||||||
|
|
||||||
Temporal.Now.plainDate("iso8601", timeZone);
|
Temporal.Now.plainDate("iso8601", timeZone);
|
||||||
Temporal.Now.plainDate("iso8601", { timeZone });
|
|
||||||
|
|
||||||
timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]";
|
timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]";
|
||||||
assert.throws(RangeError, () => Temporal.Now.plainDate("iso8601", timeZone), "leap second in time zone name not valid");
|
assert.throws(RangeError, () => Temporal.Now.plainDate("iso8601", timeZone), "leap second in time zone name not valid");
|
||||||
assert.throws(RangeError, () => Temporal.Now.plainDate("iso8601", { timeZone }), "leap second in time zone name not valid (nested property)");
|
|
||||||
|
@ -17,9 +17,4 @@ invalidStrings.forEach((timeZone) => {
|
|||||||
() => Temporal.Now.plainDate("iso8601", timeZone),
|
() => Temporal.Now.plainDate("iso8601", timeZone),
|
||||||
"reject minus zero as extended year"
|
"reject minus zero as extended year"
|
||||||
);
|
);
|
||||||
assert.throws(
|
|
||||||
RangeError,
|
|
||||||
() => Temporal.Now.plainDate("iso8601", { timeZone }),
|
|
||||||
"reject minus zero as extended year (nested property)"
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
@ -21,7 +21,6 @@ const rangeErrorTests = [
|
|||||||
|
|
||||||
for (const [timeZone, description] of rangeErrorTests) {
|
for (const [timeZone, description] of rangeErrorTests) {
|
||||||
assert.throws(RangeError, () => Temporal.Now.plainDate("iso8601", timeZone), `${description} does not convert to a valid ISO string`);
|
assert.throws(RangeError, () => Temporal.Now.plainDate("iso8601", timeZone), `${description} does not convert to a valid ISO string`);
|
||||||
assert.throws(RangeError, () => Temporal.Now.plainDate("iso8601", { timeZone }), `${description} does not convert to a valid ISO string (nested property)`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
@ -30,8 +29,4 @@ const typeErrorTests = [
|
|||||||
|
|
||||||
for (const [timeZone, description] of typeErrorTests) {
|
for (const [timeZone, description] of typeErrorTests) {
|
||||||
assert.throws(TypeError, () => Temporal.Now.plainDate("iso8601", timeZone), `${description} is not a valid object and does not convert to a string`);
|
assert.throws(TypeError, () => Temporal.Now.plainDate("iso8601", timeZone), `${description} is not a valid object and does not convert to a string`);
|
||||||
assert.throws(TypeError, () => Temporal.Now.plainDate("iso8601", { timeZone }), `${description} is not a valid object and does not convert to a string (nested property)`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const timeZone = undefined;
|
|
||||||
assert.throws(RangeError, () => Temporal.Now.plainDate("iso8601", { timeZone }), `undefined is always a RangeError as nested property`);
|
|
||||||
|
@ -10,7 +10,6 @@ features: [Temporal]
|
|||||||
|
|
||||||
const actual = [];
|
const actual = [];
|
||||||
const expected = [
|
const expected = [
|
||||||
"has timeZone.timeZone",
|
|
||||||
"get timeZone.getOffsetNanosecondsFor",
|
"get timeZone.getOffsetNanosecondsFor",
|
||||||
"call timeZone.getOffsetNanosecondsFor",
|
"call timeZone.getOffsetNanosecondsFor",
|
||||||
];
|
];
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.now.plaindateiso
|
|
||||||
description: >
|
|
||||||
A Temporal.TimeZone instance passed to plainDateISO() does not have its
|
|
||||||
'timeZone' property observably checked
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const timeZone = new Temporal.TimeZone("UTC");
|
|
||||||
Object.defineProperty(timeZone, "timeZone", {
|
|
||||||
get() {
|
|
||||||
throw new Test262Error("timeZone.timeZone should not be accessed");
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
Temporal.Now.plainDateISO(timeZone);
|
|
||||||
Temporal.Now.plainDateISO({ timeZone });
|
|
@ -9,7 +9,6 @@ features: [Temporal]
|
|||||||
|
|
||||||
let timeZone = "2021-08-19T17:30";
|
let timeZone = "2021-08-19T17:30";
|
||||||
assert.throws(RangeError, () => Temporal.Now.plainDateISO(timeZone), "bare date-time string is not a time zone");
|
assert.throws(RangeError, () => Temporal.Now.plainDateISO(timeZone), "bare date-time string is not a time zone");
|
||||||
assert.throws(RangeError, () => Temporal.Now.plainDateISO({ timeZone }), "bare date-time string is not a time zone");
|
|
||||||
|
|
||||||
// The following are all valid strings so should not throw:
|
// The following are all valid strings so should not throw:
|
||||||
|
|
||||||
@ -30,5 +29,4 @@ assert.throws(RangeError, () => Temporal.Now.plainDateISO({ timeZone }), "bare d
|
|||||||
"2021-08-19T1730-0700[UTC]",
|
"2021-08-19T1730-0700[UTC]",
|
||||||
].forEach((timeZone) => {
|
].forEach((timeZone) => {
|
||||||
Temporal.Now.plainDateISO(timeZone);
|
Temporal.Now.plainDateISO(timeZone);
|
||||||
Temporal.Now.plainDateISO({ timeZone });
|
|
||||||
});
|
});
|
||||||
|
@ -9,12 +9,10 @@ features: [Temporal]
|
|||||||
|
|
||||||
let timeZone = "2016-12-31T23:59:60+00:00[UTC]";
|
let timeZone = "2016-12-31T23:59:60+00:00[UTC]";
|
||||||
|
|
||||||
// A string with a leap second is a valid ISO string, so the following two
|
// A string with a leap second is a valid ISO string, so the following
|
||||||
// operations should not throw
|
// operation should not throw
|
||||||
|
|
||||||
Temporal.Now.plainDateISO(timeZone);
|
Temporal.Now.plainDateISO(timeZone);
|
||||||
Temporal.Now.plainDateISO({ timeZone });
|
|
||||||
|
|
||||||
timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]";
|
timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]";
|
||||||
assert.throws(RangeError, () => Temporal.Now.plainDateISO(timeZone), "leap second in time zone name not valid");
|
assert.throws(RangeError, () => Temporal.Now.plainDateISO(timeZone), "leap second in time zone name not valid");
|
||||||
assert.throws(RangeError, () => Temporal.Now.plainDateISO({ timeZone }), "leap second in time zone name not valid (nested property)");
|
|
||||||
|
@ -17,9 +17,4 @@ invalidStrings.forEach((timeZone) => {
|
|||||||
() => Temporal.Now.plainDateISO(timeZone),
|
() => Temporal.Now.plainDateISO(timeZone),
|
||||||
"reject minus zero as extended year"
|
"reject minus zero as extended year"
|
||||||
);
|
);
|
||||||
assert.throws(
|
|
||||||
RangeError,
|
|
||||||
() => Temporal.Now.plainDateISO({ timeZone }),
|
|
||||||
"reject minus zero as extended year (nested property)"
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
@ -21,7 +21,6 @@ const rangeErrorTests = [
|
|||||||
|
|
||||||
for (const [timeZone, description] of rangeErrorTests) {
|
for (const [timeZone, description] of rangeErrorTests) {
|
||||||
assert.throws(RangeError, () => Temporal.Now.plainDateISO(timeZone), `${description} does not convert to a valid ISO string`);
|
assert.throws(RangeError, () => Temporal.Now.plainDateISO(timeZone), `${description} does not convert to a valid ISO string`);
|
||||||
assert.throws(RangeError, () => Temporal.Now.plainDateISO({ timeZone }), `${description} does not convert to a valid ISO string (nested property)`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
@ -30,8 +29,4 @@ const typeErrorTests = [
|
|||||||
|
|
||||||
for (const [timeZone, description] of typeErrorTests) {
|
for (const [timeZone, description] of typeErrorTests) {
|
||||||
assert.throws(TypeError, () => Temporal.Now.plainDateISO(timeZone), `${description} is not a valid object and does not convert to a string`);
|
assert.throws(TypeError, () => Temporal.Now.plainDateISO(timeZone), `${description} is not a valid object and does not convert to a string`);
|
||||||
assert.throws(TypeError, () => Temporal.Now.plainDateISO({ timeZone }), `${description} is not a valid object and does not convert to a string (nested property)`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const timeZone = undefined;
|
|
||||||
assert.throws(RangeError, () => Temporal.Now.plainDateISO({ timeZone }), `undefined is always a RangeError as nested property`);
|
|
||||||
|
@ -9,7 +9,6 @@ features: [BigInt, Proxy, Temporal]
|
|||||||
const actual = [];
|
const actual = [];
|
||||||
|
|
||||||
const expected = [
|
const expected = [
|
||||||
'has timeZone.timeZone',
|
|
||||||
'get timeZone.getOffsetNanosecondsFor',
|
'get timeZone.getOffsetNanosecondsFor',
|
||||||
'call timeZone.getOffsetNanosecondsFor'
|
'call timeZone.getOffsetNanosecondsFor'
|
||||||
];
|
];
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.now.plaindatetime
|
|
||||||
description: >
|
|
||||||
A Temporal.TimeZone instance passed to plainDateTime() does not have its
|
|
||||||
'timeZone' property observably checked
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const timeZone = new Temporal.TimeZone("UTC");
|
|
||||||
Object.defineProperty(timeZone, "timeZone", {
|
|
||||||
get() {
|
|
||||||
throw new Test262Error("timeZone.timeZone should not be accessed");
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
Temporal.Now.plainDateTime("iso8601", timeZone);
|
|
||||||
Temporal.Now.plainDateTime("iso8601", { timeZone });
|
|
@ -1,20 +0,0 @@
|
|||||||
// Copyright (C) 2021 the V8 project authors. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.now.plaindatetime
|
|
||||||
description: Forwards error thrown by invoking "toString" property
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
var timeZone = {
|
|
||||||
timeZone: {
|
|
||||||
timeZone: true,
|
|
||||||
toString: function() {
|
|
||||||
throw new Test262Error();
|
|
||||||
},
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
assert.throws(Test262Error, function() {
|
|
||||||
Temporal.Now.plainDateTime("iso8601", timeZone);
|
|
||||||
}, 'Temporal.Now.plainDateTime("iso8601", timeZone) throws a Test262Error exception');
|
|
@ -1,17 +0,0 @@
|
|||||||
// Copyright (C) 2021 the V8 project authors. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.now.plaindatetime
|
|
||||||
description: Forwards error thrown by retrieving value of "timeZone" property
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
var timeZone = {
|
|
||||||
get timeZone() {
|
|
||||||
throw new Test262Error();
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
assert.throws(Test262Error, function() {
|
|
||||||
Temporal.Now.plainDateTime("iso8601", timeZone);
|
|
||||||
}, 'Temporal.Now.plainDateTime("iso8601", timeZone) throws a Test262Error exception');
|
|
@ -1,21 +0,0 @@
|
|||||||
// Copyright (C) 2021 the V8 project authors. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.now.plaindatetime
|
|
||||||
description: Forwards error thrown by checking presence of nested "timeZone" property
|
|
||||||
features: [Proxy, Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
var timeZone = {
|
|
||||||
timeZone: new Proxy({}, {
|
|
||||||
has: function(target, property) {
|
|
||||||
if (property === 'timeZone') {
|
|
||||||
throw new Test262Error();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
})
|
|
||||||
};
|
|
||||||
|
|
||||||
assert.throws(Test262Error, function() {
|
|
||||||
Temporal.Now.plainDateTime("iso8601", timeZone);
|
|
||||||
}, 'Temporal.Now.plainDateTime("iso8601", timeZone) throws a Test262Error exception');
|
|
@ -1,19 +0,0 @@
|
|||||||
// Copyright (C) 2021 the V8 project authors. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.now.plaindatetime
|
|
||||||
description: Forwards error thrown by checking presence of "timeZone" property
|
|
||||||
features: [Proxy, Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
var timeZone = new Proxy({}, {
|
|
||||||
has: function(target, property) {
|
|
||||||
if (property === 'timeZone') {
|
|
||||||
throw new Test262Error();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
assert.throws(Test262Error, function() {
|
|
||||||
Temporal.Now.plainDateTime("iso8601", timeZone);
|
|
||||||
}, 'Temporal.Now.plainDateTime("iso8601", timeZone) throws a Test262Error exception');
|
|
@ -9,25 +9,10 @@ features: [BigInt, Proxy, Temporal]
|
|||||||
const actual = [];
|
const actual = [];
|
||||||
|
|
||||||
const expected = [
|
const expected = [
|
||||||
'has timeZone.timeZone',
|
'get timeZone.getOffsetNanosecondsFor',
|
||||||
'get timeZone.timeZone',
|
'call timeZone.getOffsetNanosecondsFor'
|
||||||
'has nestedTimeZone.timeZone',
|
|
||||||
'get nestedTimeZone.getOffsetNanosecondsFor',
|
|
||||||
'call nestedTimeZone.getOffsetNanosecondsFor'
|
|
||||||
];
|
];
|
||||||
|
|
||||||
const nestedTimeZone = TemporalHelpers.timeZoneObserver(actual, "nestedTimeZone", {
|
|
||||||
getOffsetNanosecondsFor(instant) {
|
|
||||||
assert.sameValue(
|
|
||||||
instant instanceof Temporal.Instant,
|
|
||||||
true,
|
|
||||||
'The result of evaluating (instant instanceof Temporal.Instant) is expected to be true'
|
|
||||||
);
|
|
||||||
|
|
||||||
return -Number(instant.epochNanoseconds % 86400000000000n);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const timeZone = TemporalHelpers.timeZoneObserver(actual, "timeZone", {
|
const timeZone = TemporalHelpers.timeZoneObserver(actual, "timeZone", {
|
||||||
getOffsetNanosecondsFor(instant) {
|
getOffsetNanosecondsFor(instant) {
|
||||||
assert.sameValue(
|
assert.sameValue(
|
||||||
@ -39,7 +24,6 @@ const timeZone = TemporalHelpers.timeZoneObserver(actual, "timeZone", {
|
|||||||
return -Number(instant.epochNanoseconds % 86400000000000n);
|
return -Number(instant.epochNanoseconds % 86400000000000n);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
timeZone.timeZone = nestedTimeZone;
|
|
||||||
|
|
||||||
Object.defineProperty(Temporal.TimeZone, 'from', {
|
Object.defineProperty(Temporal.TimeZone, 'from', {
|
||||||
get() {
|
get() {
|
||||||
|
@ -9,7 +9,6 @@ features: [Temporal]
|
|||||||
|
|
||||||
let timeZone = "2021-08-19T17:30";
|
let timeZone = "2021-08-19T17:30";
|
||||||
assert.throws(RangeError, () => Temporal.Now.plainDateTime("iso8601", timeZone), "bare date-time string is not a time zone");
|
assert.throws(RangeError, () => Temporal.Now.plainDateTime("iso8601", timeZone), "bare date-time string is not a time zone");
|
||||||
assert.throws(RangeError, () => Temporal.Now.plainDateTime("iso8601", { timeZone }), "bare date-time string is not a time zone");
|
|
||||||
|
|
||||||
// The following are all valid strings so should not throw:
|
// The following are all valid strings so should not throw:
|
||||||
|
|
||||||
@ -30,5 +29,4 @@ assert.throws(RangeError, () => Temporal.Now.plainDateTime("iso8601", { timeZone
|
|||||||
"2021-08-19T1730-0700[UTC]",
|
"2021-08-19T1730-0700[UTC]",
|
||||||
].forEach((timeZone) => {
|
].forEach((timeZone) => {
|
||||||
Temporal.Now.plainDateTime("iso8601", timeZone);
|
Temporal.Now.plainDateTime("iso8601", timeZone);
|
||||||
Temporal.Now.plainDateTime("iso8601", { timeZone });
|
|
||||||
});
|
});
|
||||||
|
@ -9,12 +9,10 @@ features: [Temporal]
|
|||||||
|
|
||||||
let timeZone = "2016-12-31T23:59:60+00:00[UTC]";
|
let timeZone = "2016-12-31T23:59:60+00:00[UTC]";
|
||||||
|
|
||||||
// A string with a leap second is a valid ISO string, so the following two
|
// A string with a leap second is a valid ISO string, so the following
|
||||||
// operations should not throw
|
// operation should not throw
|
||||||
|
|
||||||
Temporal.Now.plainDateTime("iso8601", timeZone);
|
Temporal.Now.plainDateTime("iso8601", timeZone);
|
||||||
Temporal.Now.plainDateTime("iso8601", { timeZone });
|
|
||||||
|
|
||||||
timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]";
|
timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]";
|
||||||
assert.throws(RangeError, () => Temporal.Now.plainDateTime("iso8601", timeZone), "leap second in time zone name not valid");
|
assert.throws(RangeError, () => Temporal.Now.plainDateTime("iso8601", timeZone), "leap second in time zone name not valid");
|
||||||
assert.throws(RangeError, () => Temporal.Now.plainDateTime("iso8601", { timeZone }), "leap second in time zone name not valid (nested property)");
|
|
||||||
|
@ -17,9 +17,4 @@ invalidStrings.forEach((timeZone) => {
|
|||||||
() => Temporal.Now.plainDateTime("iso8601", timeZone),
|
() => Temporal.Now.plainDateTime("iso8601", timeZone),
|
||||||
"reject minus zero as extended year"
|
"reject minus zero as extended year"
|
||||||
);
|
);
|
||||||
assert.throws(
|
|
||||||
RangeError,
|
|
||||||
() => Temporal.Now.plainDateTime("iso8601", { timeZone }),
|
|
||||||
"reject minus zero as extended year (nested property)"
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
@ -21,7 +21,6 @@ const rangeErrorTests = [
|
|||||||
|
|
||||||
for (const [timeZone, description] of rangeErrorTests) {
|
for (const [timeZone, description] of rangeErrorTests) {
|
||||||
assert.throws(RangeError, () => Temporal.Now.plainDateTime("iso8601", timeZone), `${description} does not convert to a valid ISO string`);
|
assert.throws(RangeError, () => Temporal.Now.plainDateTime("iso8601", timeZone), `${description} does not convert to a valid ISO string`);
|
||||||
assert.throws(RangeError, () => Temporal.Now.plainDateTime("iso8601", { timeZone }), `${description} does not convert to a valid ISO string (nested property)`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
@ -30,8 +29,4 @@ const typeErrorTests = [
|
|||||||
|
|
||||||
for (const [timeZone, description] of typeErrorTests) {
|
for (const [timeZone, description] of typeErrorTests) {
|
||||||
assert.throws(TypeError, () => Temporal.Now.plainDateTime("iso8601", timeZone), `${description} is not a valid object and does not convert to a string`);
|
assert.throws(TypeError, () => Temporal.Now.plainDateTime("iso8601", timeZone), `${description} is not a valid object and does not convert to a string`);
|
||||||
assert.throws(TypeError, () => Temporal.Now.plainDateTime("iso8601", { timeZone }), `${description} is not a valid object and does not convert to a string (nested property)`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const timeZone = undefined;
|
|
||||||
assert.throws(RangeError, () => Temporal.Now.plainDateTime("iso8601", { timeZone }), `undefined is always a RangeError as nested property`);
|
|
||||||
|
@ -10,7 +10,6 @@ features: [Temporal]
|
|||||||
|
|
||||||
const actual = [];
|
const actual = [];
|
||||||
const expected = [
|
const expected = [
|
||||||
"has timeZone.timeZone",
|
|
||||||
"get timeZone.getOffsetNanosecondsFor",
|
"get timeZone.getOffsetNanosecondsFor",
|
||||||
"call timeZone.getOffsetNanosecondsFor",
|
"call timeZone.getOffsetNanosecondsFor",
|
||||||
];
|
];
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.now.plaindatetimeiso
|
|
||||||
description: >
|
|
||||||
A Temporal.TimeZone instance passed to plainDateTimeISO() does not have its
|
|
||||||
'timeZone' property observably checked
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const timeZone = new Temporal.TimeZone("UTC");
|
|
||||||
Object.defineProperty(timeZone, "timeZone", {
|
|
||||||
get() {
|
|
||||||
throw new Test262Error("timeZone.timeZone should not be accessed");
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
Temporal.Now.plainDateTimeISO(timeZone);
|
|
||||||
Temporal.Now.plainDateTimeISO({ timeZone });
|
|
@ -1,20 +0,0 @@
|
|||||||
// Copyright (C) 2021 the V8 project authors. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.now.plaindatetimeiso
|
|
||||||
description: Forwards error thrown by invoking "toString" property
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
var timeZone = {
|
|
||||||
timeZone: {
|
|
||||||
timeZone: true,
|
|
||||||
toString: function() {
|
|
||||||
throw new Test262Error();
|
|
||||||
},
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
assert.throws(Test262Error, function() {
|
|
||||||
Temporal.Now.plainDateTimeISO(timeZone);
|
|
||||||
}, 'Temporal.Now.plainDateTimeISO(timeZone) throws a Test262Error exception');
|
|
@ -1,17 +0,0 @@
|
|||||||
// Copyright (C) 2021 the V8 project authors. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.now.plaindatetimeiso
|
|
||||||
description: Forwards error thrown by retrieving value of "timeZone" property
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
var timeZone = {
|
|
||||||
get timeZone() {
|
|
||||||
throw new Test262Error();
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
assert.throws(Test262Error, function() {
|
|
||||||
Temporal.Now.plainDateTimeISO(timeZone);
|
|
||||||
}, 'Temporal.Now.plainDateTimeISO(timeZone) throws a Test262Error exception');
|
|
@ -1,21 +0,0 @@
|
|||||||
// Copyright (C) 2021 the V8 project authors. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.now.plaindatetimeiso
|
|
||||||
description: Forwards error thrown by checking presence of nested "timeZone" property
|
|
||||||
features: [Proxy, Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
var timeZone = {
|
|
||||||
timeZone: new Proxy({}, {
|
|
||||||
has: function(target, property) {
|
|
||||||
if (property === 'timeZone') {
|
|
||||||
throw new Test262Error();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
})
|
|
||||||
};
|
|
||||||
|
|
||||||
assert.throws(Test262Error, function() {
|
|
||||||
Temporal.Now.plainDateTimeISO(timeZone);
|
|
||||||
}, 'Temporal.Now.plainDateTimeISO(timeZone) throws a Test262Error exception');
|
|
@ -1,19 +0,0 @@
|
|||||||
// Copyright (C) 2021 the V8 project authors. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.now.plaindatetimeiso
|
|
||||||
description: Forwards error thrown by checking presence of "timeZone" property
|
|
||||||
features: [Proxy, Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
var timeZone = new Proxy({}, {
|
|
||||||
has: function(target, property) {
|
|
||||||
if (property === 'timeZone') {
|
|
||||||
throw new Test262Error();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
assert.throws(Test262Error, function() {
|
|
||||||
Temporal.Now.plainDateTimeISO(timeZone);
|
|
||||||
}, 'Temporal.Now.plainDateTimeISO(timeZone) throws a Test262Error exception');
|
|
@ -9,25 +9,10 @@ features: [BigInt, Proxy, Temporal]
|
|||||||
const actual = [];
|
const actual = [];
|
||||||
|
|
||||||
const expected = [
|
const expected = [
|
||||||
'has timeZone.timeZone',
|
'get timeZone.getOffsetNanosecondsFor',
|
||||||
'get timeZone.timeZone',
|
'call timeZone.getOffsetNanosecondsFor'
|
||||||
'has nestedTimeZone.timeZone',
|
|
||||||
'get nestedTimeZone.getOffsetNanosecondsFor',
|
|
||||||
'call nestedTimeZone.getOffsetNanosecondsFor'
|
|
||||||
];
|
];
|
||||||
|
|
||||||
const nestedTimeZone = TemporalHelpers.timeZoneObserver(actual, "nestedTimeZone", {
|
|
||||||
getOffsetNanosecondsFor(instant) {
|
|
||||||
assert.sameValue(
|
|
||||||
instant instanceof Temporal.Instant,
|
|
||||||
true,
|
|
||||||
'The result of evaluating (instant instanceof Temporal.Instant) is expected to be true'
|
|
||||||
);
|
|
||||||
|
|
||||||
return -Number(instant.epochNanoseconds % 86400000000000n);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const timeZone = TemporalHelpers.timeZoneObserver(actual, "timeZone", {
|
const timeZone = TemporalHelpers.timeZoneObserver(actual, "timeZone", {
|
||||||
getOffsetNanosecondsFor(instant) {
|
getOffsetNanosecondsFor(instant) {
|
||||||
assert.sameValue(
|
assert.sameValue(
|
||||||
@ -39,7 +24,6 @@ const timeZone = TemporalHelpers.timeZoneObserver(actual, "timeZone", {
|
|||||||
return -Number(instant.epochNanoseconds % 86400000000000n);
|
return -Number(instant.epochNanoseconds % 86400000000000n);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
timeZone.timeZone = nestedTimeZone;
|
|
||||||
|
|
||||||
Object.defineProperty(Temporal.TimeZone, 'from', {
|
Object.defineProperty(Temporal.TimeZone, 'from', {
|
||||||
get() {
|
get() {
|
||||||
|
@ -9,7 +9,6 @@ features: [Temporal]
|
|||||||
|
|
||||||
let timeZone = "2021-08-19T17:30";
|
let timeZone = "2021-08-19T17:30";
|
||||||
assert.throws(RangeError, () => Temporal.Now.plainDateTimeISO(timeZone), "bare date-time string is not a time zone");
|
assert.throws(RangeError, () => Temporal.Now.plainDateTimeISO(timeZone), "bare date-time string is not a time zone");
|
||||||
assert.throws(RangeError, () => Temporal.Now.plainDateTimeISO({ timeZone }), "bare date-time string is not a time zone");
|
|
||||||
|
|
||||||
// The following are all valid strings so should not throw:
|
// The following are all valid strings so should not throw:
|
||||||
|
|
||||||
@ -30,5 +29,4 @@ assert.throws(RangeError, () => Temporal.Now.plainDateTimeISO({ timeZone }), "ba
|
|||||||
"2021-08-19T1730-0700[UTC]",
|
"2021-08-19T1730-0700[UTC]",
|
||||||
].forEach((timeZone) => {
|
].forEach((timeZone) => {
|
||||||
Temporal.Now.plainDateTimeISO(timeZone);
|
Temporal.Now.plainDateTimeISO(timeZone);
|
||||||
Temporal.Now.plainDateTimeISO({ timeZone });
|
|
||||||
});
|
});
|
||||||
|
@ -9,12 +9,10 @@ features: [Temporal]
|
|||||||
|
|
||||||
let timeZone = "2016-12-31T23:59:60+00:00[UTC]";
|
let timeZone = "2016-12-31T23:59:60+00:00[UTC]";
|
||||||
|
|
||||||
// A string with a leap second is a valid ISO string, so the following two
|
// A string with a leap second is a valid ISO string, so the following
|
||||||
// operations should not throw
|
// operation should not throw
|
||||||
|
|
||||||
Temporal.Now.plainDateTimeISO(timeZone);
|
Temporal.Now.plainDateTimeISO(timeZone);
|
||||||
Temporal.Now.plainDateTimeISO({ timeZone });
|
|
||||||
|
|
||||||
timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]";
|
timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]";
|
||||||
assert.throws(RangeError, () => Temporal.Now.plainDateTimeISO(timeZone), "leap second in time zone name not valid");
|
assert.throws(RangeError, () => Temporal.Now.plainDateTimeISO(timeZone), "leap second in time zone name not valid");
|
||||||
assert.throws(RangeError, () => Temporal.Now.plainDateTimeISO({ timeZone }), "leap second in time zone name not valid (nested property)");
|
|
||||||
|
@ -17,9 +17,4 @@ invalidStrings.forEach((timeZone) => {
|
|||||||
() => Temporal.Now.plainDateTimeISO(timeZone),
|
() => Temporal.Now.plainDateTimeISO(timeZone),
|
||||||
"reject minus zero as extended year"
|
"reject minus zero as extended year"
|
||||||
);
|
);
|
||||||
assert.throws(
|
|
||||||
RangeError,
|
|
||||||
() => Temporal.Now.plainDateTimeISO({ timeZone }),
|
|
||||||
"reject minus zero as extended year (nested property)"
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
@ -21,7 +21,6 @@ const rangeErrorTests = [
|
|||||||
|
|
||||||
for (const [timeZone, description] of rangeErrorTests) {
|
for (const [timeZone, description] of rangeErrorTests) {
|
||||||
assert.throws(RangeError, () => Temporal.Now.plainDateTimeISO(timeZone), `${description} does not convert to a valid ISO string`);
|
assert.throws(RangeError, () => Temporal.Now.plainDateTimeISO(timeZone), `${description} does not convert to a valid ISO string`);
|
||||||
assert.throws(RangeError, () => Temporal.Now.plainDateTimeISO({ timeZone }), `${description} does not convert to a valid ISO string (nested property)`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
@ -30,8 +29,4 @@ const typeErrorTests = [
|
|||||||
|
|
||||||
for (const [timeZone, description] of typeErrorTests) {
|
for (const [timeZone, description] of typeErrorTests) {
|
||||||
assert.throws(TypeError, () => Temporal.Now.plainDateTimeISO(timeZone), `${description} is not a valid object and does not convert to a string`);
|
assert.throws(TypeError, () => Temporal.Now.plainDateTimeISO(timeZone), `${description} is not a valid object and does not convert to a string`);
|
||||||
assert.throws(TypeError, () => Temporal.Now.plainDateTimeISO({ timeZone }), `${description} is not a valid object and does not convert to a string (nested property)`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const timeZone = undefined;
|
|
||||||
assert.throws(RangeError, () => Temporal.Now.plainDateTimeISO({ timeZone }), `undefined is always a RangeError as nested property`);
|
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.now.plaintimeiso
|
|
||||||
description: >
|
|
||||||
A Temporal.TimeZone instance passed to plainTimeISO() does not have its
|
|
||||||
'timeZone' property observably checked
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const timeZone = new Temporal.TimeZone("UTC");
|
|
||||||
Object.defineProperty(timeZone, "timeZone", {
|
|
||||||
get() {
|
|
||||||
throw new Test262Error("timeZone.timeZone should not be accessed");
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
Temporal.Now.plainTimeISO(timeZone);
|
|
||||||
Temporal.Now.plainTimeISO({ timeZone });
|
|
@ -9,7 +9,6 @@ features: [Temporal]
|
|||||||
|
|
||||||
let timeZone = "2021-08-19T17:30";
|
let timeZone = "2021-08-19T17:30";
|
||||||
assert.throws(RangeError, () => Temporal.Now.plainTimeISO(timeZone), "bare date-time string is not a time zone");
|
assert.throws(RangeError, () => Temporal.Now.plainTimeISO(timeZone), "bare date-time string is not a time zone");
|
||||||
assert.throws(RangeError, () => Temporal.Now.plainTimeISO({ timeZone }), "bare date-time string is not a time zone");
|
|
||||||
|
|
||||||
// The following are all valid strings so should not throw:
|
// The following are all valid strings so should not throw:
|
||||||
|
|
||||||
@ -30,5 +29,4 @@ assert.throws(RangeError, () => Temporal.Now.plainTimeISO({ timeZone }), "bare d
|
|||||||
"2021-08-19T1730-0700[UTC]",
|
"2021-08-19T1730-0700[UTC]",
|
||||||
].forEach((timeZone) => {
|
].forEach((timeZone) => {
|
||||||
Temporal.Now.plainTimeISO(timeZone);
|
Temporal.Now.plainTimeISO(timeZone);
|
||||||
Temporal.Now.plainTimeISO({ timeZone });
|
|
||||||
});
|
});
|
||||||
|
@ -9,12 +9,10 @@ features: [Temporal]
|
|||||||
|
|
||||||
let timeZone = "2016-12-31T23:59:60+00:00[UTC]";
|
let timeZone = "2016-12-31T23:59:60+00:00[UTC]";
|
||||||
|
|
||||||
// A string with a leap second is a valid ISO string, so the following two
|
// A string with a leap second is a valid ISO string, so the following
|
||||||
// operations should not throw
|
// operation should not throw
|
||||||
|
|
||||||
Temporal.Now.plainTimeISO(timeZone);
|
Temporal.Now.plainTimeISO(timeZone);
|
||||||
Temporal.Now.plainTimeISO({ timeZone });
|
|
||||||
|
|
||||||
timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]";
|
timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]";
|
||||||
assert.throws(RangeError, () => Temporal.Now.plainTimeISO(timeZone), "leap second in time zone name not valid");
|
assert.throws(RangeError, () => Temporal.Now.plainTimeISO(timeZone), "leap second in time zone name not valid");
|
||||||
assert.throws(RangeError, () => Temporal.Now.plainTimeISO({ timeZone }), "leap second in time zone name not valid (nested property)");
|
|
||||||
|
@ -17,9 +17,4 @@ invalidStrings.forEach((timeZone) => {
|
|||||||
() => Temporal.Now.plainTimeISO(timeZone),
|
() => Temporal.Now.plainTimeISO(timeZone),
|
||||||
"reject minus zero as extended year"
|
"reject minus zero as extended year"
|
||||||
);
|
);
|
||||||
assert.throws(
|
|
||||||
RangeError,
|
|
||||||
() => Temporal.Now.plainTimeISO({ timeZone }),
|
|
||||||
"reject minus zero as extended year (nested property)"
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
@ -21,7 +21,6 @@ const rangeErrorTests = [
|
|||||||
|
|
||||||
for (const [timeZone, description] of rangeErrorTests) {
|
for (const [timeZone, description] of rangeErrorTests) {
|
||||||
assert.throws(RangeError, () => Temporal.Now.plainTimeISO(timeZone), `${description} does not convert to a valid ISO string`);
|
assert.throws(RangeError, () => Temporal.Now.plainTimeISO(timeZone), `${description} does not convert to a valid ISO string`);
|
||||||
assert.throws(RangeError, () => Temporal.Now.plainTimeISO({ timeZone }), `${description} does not convert to a valid ISO string (nested property)`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
@ -30,8 +29,4 @@ const typeErrorTests = [
|
|||||||
|
|
||||||
for (const [timeZone, description] of typeErrorTests) {
|
for (const [timeZone, description] of typeErrorTests) {
|
||||||
assert.throws(TypeError, () => Temporal.Now.plainTimeISO(timeZone), `${description} is not a valid object and does not convert to a string`);
|
assert.throws(TypeError, () => Temporal.Now.plainTimeISO(timeZone), `${description} is not a valid object and does not convert to a string`);
|
||||||
assert.throws(TypeError, () => Temporal.Now.plainTimeISO({ timeZone }), `${description} is not a valid object and does not convert to a string (nested property)`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const timeZone = undefined;
|
|
||||||
assert.throws(RangeError, () => Temporal.Now.plainTimeISO({ timeZone }), `undefined is always a RangeError as nested property`);
|
|
||||||
|
@ -10,7 +10,6 @@ features: [Temporal]
|
|||||||
|
|
||||||
const actual = [];
|
const actual = [];
|
||||||
const expected = [
|
const expected = [
|
||||||
"has timeZone.timeZone",
|
|
||||||
"get timeZone.getOffsetNanosecondsFor",
|
"get timeZone.getOffsetNanosecondsFor",
|
||||||
"call timeZone.getOffsetNanosecondsFor",
|
"call timeZone.getOffsetNanosecondsFor",
|
||||||
];
|
];
|
||||||
|
@ -10,7 +10,6 @@ features: [Temporal]
|
|||||||
|
|
||||||
const actual = [];
|
const actual = [];
|
||||||
const expected = [
|
const expected = [
|
||||||
"has timeZone.timeZone",
|
|
||||||
"get timeZone.getOffsetNanosecondsFor",
|
"get timeZone.getOffsetNanosecondsFor",
|
||||||
"call timeZone.getOffsetNanosecondsFor",
|
"call timeZone.getOffsetNanosecondsFor",
|
||||||
];
|
];
|
||||||
|
@ -8,10 +8,6 @@ features: [BigInt, Proxy, Temporal]
|
|||||||
---*/
|
---*/
|
||||||
const actual = [];
|
const actual = [];
|
||||||
|
|
||||||
const expected = [
|
|
||||||
'has timeZone.timeZone'
|
|
||||||
];
|
|
||||||
|
|
||||||
const calendar = function() {};
|
const calendar = function() {};
|
||||||
|
|
||||||
const timeZone = TemporalHelpers.timeZoneObserver(actual, "timeZone", {
|
const timeZone = TemporalHelpers.timeZoneObserver(actual, "timeZone", {
|
||||||
@ -29,7 +25,7 @@ Object.defineProperty(Temporal.Calendar, 'from', {
|
|||||||
|
|
||||||
const result = Temporal.Now.zonedDateTime(calendar, timeZone);
|
const result = Temporal.Now.zonedDateTime(calendar, timeZone);
|
||||||
|
|
||||||
assert.compareArray(actual, expected, 'The value of actual is expected to equal the value of expected');
|
assert.compareArray(actual, [], 'no observable operations should be invoked');
|
||||||
|
|
||||||
for (const property of ['hour', 'minute', 'second', 'millisecond', 'microsecond', 'nanosecond']) {
|
for (const property of ['hour', 'minute', 'second', 'millisecond', 'microsecond', 'nanosecond']) {
|
||||||
assert.sameValue(result[property], 0, 'The value of result[property] is expected to be 0');
|
assert.sameValue(result[property], 0, 'The value of result[property] is expected to be 0');
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.now.zoneddatetime
|
|
||||||
description: >
|
|
||||||
A Temporal.TimeZone instance passed to zonedDateTime() does not have its
|
|
||||||
'timeZone' property observably checked
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const timeZone = new Temporal.TimeZone("UTC");
|
|
||||||
Object.defineProperty(timeZone, "timeZone", {
|
|
||||||
get() {
|
|
||||||
throw new Test262Error("timeZone.timeZone should not be accessed");
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
Temporal.Now.zonedDateTime("iso8601", timeZone);
|
|
||||||
Temporal.Now.zonedDateTime("iso8601", { timeZone });
|
|
@ -1,20 +0,0 @@
|
|||||||
// Copyright (C) 2021 the V8 project authors. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.now.zoneddatetime
|
|
||||||
description: Forwards error thrown by invoking "toString" property
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
var timeZone = {
|
|
||||||
timeZone: {
|
|
||||||
timeZone: true,
|
|
||||||
toString: function() {
|
|
||||||
throw new Test262Error();
|
|
||||||
},
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
assert.throws(Test262Error, function() {
|
|
||||||
Temporal.Now.zonedDateTime("iso8601", timeZone);
|
|
||||||
}, 'Temporal.Now.zonedDateTime("iso8601", timeZone) throws a Test262Error exception');
|
|
@ -1,17 +0,0 @@
|
|||||||
// Copyright (C) 2021 the V8 project authors. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.now.zoneddatetime
|
|
||||||
description: Forwards error thrown by retrieving value of "timeZone" property
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
var timeZone = {
|
|
||||||
get timeZone() {
|
|
||||||
throw new Test262Error();
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
assert.throws(Test262Error, function() {
|
|
||||||
Temporal.Now.zonedDateTime("iso8601", timeZone);
|
|
||||||
}, 'Temporal.Now.zonedDateTime("iso8601", timeZone) throws a Test262Error exception');
|
|
@ -1,21 +0,0 @@
|
|||||||
// Copyright (C) 2021 the V8 project authors. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.now.zoneddatetime
|
|
||||||
description: Forwards error thrown by checking presence of nested "timeZone" property
|
|
||||||
features: [Proxy, Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
var timeZone = {
|
|
||||||
timeZone: new Proxy({}, {
|
|
||||||
has: function(target, property) {
|
|
||||||
if (property === 'timeZone') {
|
|
||||||
throw new Test262Error();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
})
|
|
||||||
};
|
|
||||||
|
|
||||||
assert.throws(Test262Error, function() {
|
|
||||||
Temporal.Now.zonedDateTime("iso8601", timeZone);
|
|
||||||
}, 'Temporal.Now.zonedDateTime("iso8601", timeZone) throws a Test262Error exception');
|
|
@ -1,19 +0,0 @@
|
|||||||
// Copyright (C) 2021 the V8 project authors. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.now.zoneddatetime
|
|
||||||
description: Forwards error thrown by checking presence of "timeZone" property
|
|
||||||
features: [Proxy, Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
var timeZone = new Proxy({}, {
|
|
||||||
has: function(target, property) {
|
|
||||||
if (property === 'timeZone') {
|
|
||||||
throw new Test262Error();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
assert.throws(Test262Error, function() {
|
|
||||||
Temporal.Now.zonedDateTime("iso8601", timeZone);
|
|
||||||
}, 'Temporal.Now.zonedDateTime("iso8601", timeZone) throws a Test262Error exception');
|
|
@ -8,24 +8,6 @@ features: [BigInt, Proxy, Temporal]
|
|||||||
---*/
|
---*/
|
||||||
const actual = [];
|
const actual = [];
|
||||||
|
|
||||||
const expected = [
|
|
||||||
'has timeZone.timeZone',
|
|
||||||
'get timeZone.timeZone',
|
|
||||||
'has nestedTimeZone.timeZone'
|
|
||||||
];
|
|
||||||
|
|
||||||
const nestedTimeZone = TemporalHelpers.timeZoneObserver(actual, "nestedTimeZone", {
|
|
||||||
getOffsetNanosecondsFor(instant) {
|
|
||||||
assert.sameValue(
|
|
||||||
instant instanceof Temporal.Instant,
|
|
||||||
true,
|
|
||||||
'The result of evaluating (instant instanceof Temporal.Instant) is expected to be true'
|
|
||||||
);
|
|
||||||
|
|
||||||
return -Number(instant.epochNanoseconds % 86400000000000n);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const timeZone = TemporalHelpers.timeZoneObserver(actual, "timeZone", {
|
const timeZone = TemporalHelpers.timeZoneObserver(actual, "timeZone", {
|
||||||
getOffsetNanosecondsFor(instant) {
|
getOffsetNanosecondsFor(instant) {
|
||||||
assert.sameValue(
|
assert.sameValue(
|
||||||
@ -37,7 +19,6 @@ const timeZone = TemporalHelpers.timeZoneObserver(actual, "timeZone", {
|
|||||||
return -Number(instant.epochNanoseconds % 86400000000000n);
|
return -Number(instant.epochNanoseconds % 86400000000000n);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
timeZone.timeZone = nestedTimeZone;
|
|
||||||
|
|
||||||
Object.defineProperty(Temporal.TimeZone, 'from', {
|
Object.defineProperty(Temporal.TimeZone, 'from', {
|
||||||
get() {
|
get() {
|
||||||
@ -47,4 +28,4 @@ Object.defineProperty(Temporal.TimeZone, 'from', {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Temporal.Now.zonedDateTime('iso8601', timeZone);
|
Temporal.Now.zonedDateTime('iso8601', timeZone);
|
||||||
assert.compareArray(actual, expected, 'The value of actual is expected to equal the value of expected');
|
assert.compareArray(actual, [], 'no observable operations should be invoked');
|
||||||
|
@ -9,34 +9,23 @@ features: [Temporal]
|
|||||||
|
|
||||||
let timeZone = "2021-08-19T17:30";
|
let timeZone = "2021-08-19T17:30";
|
||||||
assert.throws(RangeError, () => Temporal.Now.zonedDateTime("iso8601", timeZone), "bare date-time string is not a time zone");
|
assert.throws(RangeError, () => Temporal.Now.zonedDateTime("iso8601", timeZone), "bare date-time string is not a time zone");
|
||||||
assert.throws(RangeError, () => Temporal.Now.zonedDateTime("iso8601", { timeZone }), "bare date-time string is not a time zone");
|
|
||||||
|
|
||||||
timeZone = "2021-08-19T17:30Z";
|
timeZone = "2021-08-19T17:30Z";
|
||||||
const result1 = Temporal.Now.zonedDateTime("iso8601", timeZone);
|
const result1 = Temporal.Now.zonedDateTime("iso8601", timeZone);
|
||||||
assert.sameValue(result1.timeZoneId, "UTC", "date-time + Z is UTC time zone");
|
assert.sameValue(result1.timeZoneId, "UTC", "date-time + Z is UTC time zone");
|
||||||
const result2 = Temporal.Now.zonedDateTime("iso8601", { timeZone });
|
|
||||||
assert.sameValue(result2.timeZoneId, "UTC", "date-time + Z is UTC time zone (string in property bag)");
|
|
||||||
|
|
||||||
timeZone = "2021-08-19T17:30-07:00";
|
timeZone = "2021-08-19T17:30-07:00";
|
||||||
const result3 = Temporal.Now.zonedDateTime("iso8601", timeZone);
|
const result2 = Temporal.Now.zonedDateTime("iso8601", timeZone);
|
||||||
assert.sameValue(result3.timeZoneId, "-07:00", "date-time + offset is the offset time zone");
|
assert.sameValue(result2.timeZoneId, "-07:00", "date-time + offset is the offset time zone");
|
||||||
const result4 = Temporal.Now.zonedDateTime("iso8601", { timeZone });
|
|
||||||
assert.sameValue(result4.timeZoneId, "-07:00", "date-time + offset is the offset time zone (string in property bag)");
|
|
||||||
|
|
||||||
timeZone = "2021-08-19T17:30[UTC]";
|
timeZone = "2021-08-19T17:30[UTC]";
|
||||||
const result5 = Temporal.Now.zonedDateTime("iso8601", timeZone);
|
const result3 = Temporal.Now.zonedDateTime("iso8601", timeZone);
|
||||||
assert.sameValue(result5.timeZoneId, "UTC", "date-time + IANA annotation is the IANA time zone");
|
assert.sameValue(result3.timeZoneId, "UTC", "date-time + IANA annotation is the IANA time zone");
|
||||||
const result6 = Temporal.Now.zonedDateTime("iso8601", { timeZone });
|
|
||||||
assert.sameValue(result6.timeZoneId, "UTC", "date-time + IANA annotation is the IANA time zone (string in property bag)");
|
|
||||||
|
|
||||||
timeZone = "2021-08-19T17:30Z[UTC]";
|
timeZone = "2021-08-19T17:30Z[UTC]";
|
||||||
const result7 = Temporal.Now.zonedDateTime("iso8601", timeZone);
|
const result4 = Temporal.Now.zonedDateTime("iso8601", timeZone);
|
||||||
assert.sameValue(result7.timeZoneId, "UTC", "date-time + Z + IANA annotation is the IANA time zone");
|
assert.sameValue(result4.timeZoneId, "UTC", "date-time + Z + IANA annotation is the IANA time zone");
|
||||||
const result8 = Temporal.Now.zonedDateTime("iso8601", { timeZone });
|
|
||||||
assert.sameValue(result8.timeZoneId, "UTC", "date-time + Z + IANA annotation is the IANA time zone (string in property bag)");
|
|
||||||
|
|
||||||
timeZone = "2021-08-19T17:30-07:00[UTC]";
|
timeZone = "2021-08-19T17:30-07:00[UTC]";
|
||||||
const result9 = Temporal.Now.zonedDateTime("iso8601", timeZone);
|
const result5 = Temporal.Now.zonedDateTime("iso8601", timeZone);
|
||||||
assert.sameValue(result9.timeZoneId, "UTC", "date-time + offset + IANA annotation is the IANA time zone");
|
assert.sameValue(result5.timeZoneId, "UTC", "date-time + offset + IANA annotation is the IANA time zone");
|
||||||
const result10 = Temporal.Now.zonedDateTime("iso8601", { timeZone });
|
|
||||||
assert.sameValue(result10.timeZoneId, "UTC", "date-time + offset + IANA annotation is the IANA time zone (string in property bag)");
|
|
||||||
|
@ -9,11 +9,8 @@ features: [Temporal]
|
|||||||
|
|
||||||
let timeZone = "2016-12-31T23:59:60+00:00[UTC]";
|
let timeZone = "2016-12-31T23:59:60+00:00[UTC]";
|
||||||
|
|
||||||
const result1 = Temporal.Now.zonedDateTime("iso8601", timeZone);
|
const result = Temporal.Now.zonedDateTime("iso8601", timeZone);
|
||||||
assert.sameValue(result1.timeZoneId, "UTC", "leap second is a valid ISO string for TimeZone");
|
assert.sameValue(result.timeZoneId, "UTC", "leap second is a valid ISO string for TimeZone");
|
||||||
const result2 = Temporal.Now.zonedDateTime("iso8601", { timeZone });
|
|
||||||
assert.sameValue(result2.timeZoneId, "UTC", "leap second is a valid ISO string for TimeZone (nested property)");
|
|
||||||
|
|
||||||
timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]";
|
timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]";
|
||||||
assert.throws(RangeError, () => Temporal.Now.zonedDateTime("iso8601", timeZone), "leap second in time zone name not valid");
|
assert.throws(RangeError, () => Temporal.Now.zonedDateTime("iso8601", timeZone), "leap second in time zone name not valid");
|
||||||
assert.throws(RangeError, () => Temporal.Now.zonedDateTime("iso8601", { timeZone }), "leap second in time zone name not valid (nested property)");
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user