mirror of
https://github.com/tc39/test262.git
synced 2025-07-23 14:04:51 +02:00
Test offset property in ZonedDateTime property bags
https://github.com/tc39/proposal-temporal/pull/1893 was a bug that caused the 'offset' property to be ignored in ZonedDateTime property bags. Add tests that ensure it is not ignored. This was a normative change that achieved consensus at the October 2021 TC39 meeting.
This commit is contained in:
parent
7835f64ae0
commit
141aca7dba
@ -0,0 +1,15 @@
|
|||||||
|
// 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.zoneddatetime.compare
|
||||||
|
description: Property bag with offset property is rejected if offset does not agree with time zone
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const timeZone = new Temporal.TimeZone("+01:00");
|
||||||
|
const datetime = new Temporal.ZonedDateTime(0n, timeZone);
|
||||||
|
|
||||||
|
const properties = { year: 2021, month: 10, day: 28, offset: "-07:00", timeZone };
|
||||||
|
assert.throws(RangeError, () => Temporal.ZonedDateTime.compare(properties, datetime), "offset property not matching time zone is rejected (first argument)");
|
||||||
|
assert.throws(RangeError, () => Temporal.ZonedDateTime.compare(datetime, properties), "offset property not matching time zone is rejected (second argument)");
|
@ -0,0 +1,13 @@
|
|||||||
|
// 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.zoneddatetime.from
|
||||||
|
description: Property bag with offset property is rejected if offset does not agree with time zone
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const timeZone = new Temporal.TimeZone("+01:00");
|
||||||
|
|
||||||
|
const properties = { year: 2021, month: 10, day: 28, offset: "-07:00", timeZone };
|
||||||
|
assert.throws(RangeError, () => Temporal.ZonedDateTime.from(properties), "offset property not matching time zone is rejected");
|
@ -0,0 +1,14 @@
|
|||||||
|
// 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.zoneddatetime.prototype.equals
|
||||||
|
description: Property bag with offset property is rejected if offset does not agree with time zone
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const timeZone = new Temporal.TimeZone("+01:00");
|
||||||
|
const instance = new Temporal.ZonedDateTime(0n, timeZone);
|
||||||
|
|
||||||
|
const properties = { year: 2021, month: 10, day: 28, offset: "-07:00", timeZone };
|
||||||
|
assert.throws(RangeError, () => instance.equals(properties), "offset property not matching time zone is rejected");
|
@ -0,0 +1,14 @@
|
|||||||
|
// 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.zoneddatetime.prototype.since
|
||||||
|
description: Property bag with offset property is rejected if offset does not agree with time zone
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const timeZone = new Temporal.TimeZone("+01:00");
|
||||||
|
const instance = new Temporal.ZonedDateTime(0n, timeZone);
|
||||||
|
|
||||||
|
const properties = { year: 2021, month: 10, day: 28, offset: "-07:00", timeZone };
|
||||||
|
assert.throws(RangeError, () => instance.since(properties), "offset property not matching time zone is rejected");
|
@ -0,0 +1,14 @@
|
|||||||
|
// 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.zoneddatetime.prototype.until
|
||||||
|
description: Property bag with offset property is rejected if offset does not agree with time zone
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const timeZone = new Temporal.TimeZone("+01:00");
|
||||||
|
const instance = new Temporal.ZonedDateTime(0n, timeZone);
|
||||||
|
|
||||||
|
const properties = { year: 2021, month: 10, day: 28, offset: "-07:00", timeZone };
|
||||||
|
assert.throws(RangeError, () => instance.until(properties), "offset property not matching time zone is rejected");
|
Loading…
x
Reference in New Issue
Block a user