mirror of https://github.com/tc39/test262.git
38 lines
1.5 KiB
JavaScript
38 lines
1.5 KiB
JavaScript
// 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: Time zone IDs are valid input for a time zone
|
|
includes: [temporalHelpers.js]
|
|
features: [Temporal]
|
|
---*/
|
|
|
|
const getPossibleInstantsForOriginal = Object.getOwnPropertyDescriptor(Temporal.TimeZone.prototype, "getPossibleInstantsFor");
|
|
Object.defineProperty(Temporal.TimeZone.prototype, "getPossibleInstantsFor", {
|
|
configurable: true,
|
|
enumerable: false,
|
|
get() {
|
|
TemporalHelpers.assertUnreachable("getPossibleInstantsFor should not be looked up");
|
|
},
|
|
});
|
|
const getOffsetNanosecondsForOriginal = Object.getOwnPropertyDescriptor(Temporal.TimeZone.prototype, "getOffsetNanosecondsFor");
|
|
Object.defineProperty(Temporal.TimeZone.prototype, "getOffsetNanosecondsFor", {
|
|
configurable: true,
|
|
enumerable: false,
|
|
get() {
|
|
TemporalHelpers.assertUnreachable("getOffsetNanosecondsFor should not be looked up");
|
|
},
|
|
});
|
|
|
|
["UTC", "+01:30"].forEach((timeZone) => {
|
|
const epoch = new Temporal.ZonedDateTime(0n, new Temporal.TimeZone(timeZone));
|
|
|
|
// These should be valid input and not throw
|
|
Temporal.ZonedDateTime.compare({ year: 2020, month: 5, day: 2, timeZone }, epoch);
|
|
Temporal.ZonedDateTime.compare(epoch, { year: 2020, month: 5, day: 2, timeZone });
|
|
});
|
|
|
|
Object.defineProperty(Temporal.TimeZone.prototype, "getPossibleInstantsFor", getPossibleInstantsForOriginal);
|
|
Object.defineProperty(Temporal.TimeZone.prototype, "getOffsetNanosecondsFor", getOffsetNanosecondsForOriginal);
|