mirror of
https://github.com/tc39/test262.git
synced 2025-07-31 01:44:54 +02:00
As per the discussion in https://github.com/tc39/proposal-temporal/issues/2379#issuecomment-1248557100 and the PR https://github.com/tc39/proposal-temporal/pull/2398, which is to be presented for consensus to TC39 in the upcoming plenary meeting, UTC offsets and the Z designator should be disallowed after any date-only strings (YYYY-MM-DD, YYYY-MM, and MM-DD). They should only be allowed to follow a time component. Z remains disallowed in any string being parsed into a Plain type. Annotations become allowed after any ISO string, even YYYY-MM and MM-DD where they were previously disallowed.
34 lines
1.2 KiB
JavaScript
34 lines
1.2 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.plaindate.compare
|
|
description: Various forms of time zone annotation; critical flag has no effect
|
|
features: [Temporal]
|
|
---*/
|
|
|
|
const tests = [
|
|
['2000-05-02[Asia/Kolkata]', 'named, with no time'],
|
|
['2000-05-02[!Europe/Vienna]', 'named, with ! and no time'],
|
|
['2000-05-02[+00:00]', 'numeric, with no time'],
|
|
['2000-05-02[!-02:30]', 'numeric, with ! and no time'],
|
|
["2000-05-02T15:23[America/Sao_Paulo]", "named, with no offset"],
|
|
["2000-05-02T15:23[!Asia/Tokyo]", "named, with ! and no offset"],
|
|
["2000-05-02T15:23[-02:30]", "numeric, with no offset"],
|
|
["2000-05-02T15:23[!+00:00]", "numeric, with ! and no offset"],
|
|
["2000-05-02T15:23+00:00[America/New_York]", "named, with offset"],
|
|
["2000-05-02T15:23+00:00[!UTC]", "named, with offset and !"],
|
|
["2000-05-02T15:23+00:00[+01:00]", "numeric, with offset"],
|
|
["2000-05-02T15:23+00:00[!-08:00]", "numeric, with offset and !"],
|
|
];
|
|
|
|
tests.forEach(([arg, description]) => {
|
|
const result = Temporal.PlainDate.compare(arg, arg);
|
|
|
|
assert.sameValue(
|
|
result,
|
|
0,
|
|
`time zone annotation (${description})`
|
|
);
|
|
});
|