mirror of
https://github.com/tc39/test262.git
synced 2025-07-31 01:44:54 +02:00
In many cases we created a TimeZone or Calendar instance from a built-in time zone or calendar. These tests can be trivially adapted to just use the string ID.
31 lines
847 B
JavaScript
31 lines
847 B
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: Negative zero, as an extended year, is rejected
|
|
features: [Temporal, arrow-function]
|
|
---*/
|
|
|
|
const datetime = new Temporal.ZonedDateTime(0n, "UTC");
|
|
const invalidStrings = [
|
|
"-000000-10-31",
|
|
"-000000-10-31T17:45",
|
|
"-000000-10-31T17:45Z",
|
|
"-000000-10-31T17:45+01:00",
|
|
"-000000-10-31T17:45+00:00[UTC]",
|
|
];
|
|
|
|
invalidStrings.forEach((arg) => {
|
|
assert.throws(
|
|
RangeError,
|
|
() => Temporal.ZonedDateTime.compare(arg, datetime),
|
|
"reject minus zero as extended year (first argument)"
|
|
);
|
|
assert.throws(
|
|
RangeError,
|
|
() => Temporal.ZonedDateTime.compare(datetime, arg),
|
|
"reject minus zero as extended year (second argument)"
|
|
);
|
|
});
|