Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No U+2122 MINUS SIGN in offset time zone IDs and ISO 8601 strings #4120

Merged
merged 2 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions harness/temporalHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -2130,7 +2130,7 @@ var TemporalHelpers = {
"1976-11-01T00:00:00+05:00",
"197611",
"+00197611",
"1976-11-18T15:23:30.1\u221202:00",
"1976-11-18T15:23:30.1-02:00",
"1976-11-18T152330.1+00:00",
"19761118T15:23:30.1+00:00",
"1976-11-18T15:23:30.1+0000",
Expand All @@ -2157,7 +2157,7 @@ var TemporalHelpers = {
*/
plainYearMonthStringsValidNegativeYear() {
return [
"\u2212009999-11",
"-009999-11",
];
},
}
Expand Down
2 changes: 0 additions & 2 deletions test/built-ins/Temporal/Duration/from/argument-string.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ TemporalHelpers.assertDuration(Temporal.Duration.from("+P1D"),
0, 0, 0, 1, 0, 0, 0, 0, 0, 0);
TemporalHelpers.assertDuration(Temporal.Duration.from("-P1D"),
0, 0, 0, -1, 0, 0, 0, 0, 0, 0);
TemporalHelpers.assertDuration(Temporal.Duration.from("\u2212P1D"),
0, 0, 0, -1, 0, 0, 0, 0, 0, 0);
TemporalHelpers.assertDuration(Temporal.Duration.from("-P1Y1M1W1DT1H1M1.123456789S"),
-1, -1, -1, -1, -1, -1, -1, -123, -456, -789);
TemporalHelpers.assertDuration(Temporal.Duration.from("PT100M"),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright (C) 2024 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-temporal.instant.compare
description: Non-ASCII minus sign is not acceptable
features: [Temporal]
---*/

const invalidStrings = [
"1976-11-18T15:23:30.12\u221202:00",
"\u2212009999-11-18T15:23:30.12",
];

const epoch = new Temporal.Instant(0n);
invalidStrings.forEach((arg) => {
assert.throws(
RangeError,
() => Temporal.Instant.compare(arg, epoch),
`variant minus sign: ${arg} (first argument)`
);

assert.throws(
RangeError,
() => Temporal.Instant.compare(epoch, arg),
`variant minus sign: ${arg} (second argument)`
);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (C) 2024 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-temporal.instant.from
description: Non-ASCII minus sign is not acceptable
features: [Temporal]
---*/

const invalidStrings = [
"1976-11-18T15:23:30.12\u221202:00",
"\u2212009999-11-18T15:23:30.12",
];

invalidStrings.forEach((arg) => {
assert.throws(
RangeError,
() => Temporal.Instant.from(arg),
`variant minus sign: ${arg}`
);
});
4 changes: 2 additions & 2 deletions test/built-ins/Temporal/Instant/from/argument-string.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const tests = [
['1976-11-18T15:23:30.12345678Z', 217178610123456780n],
['1976-11-18T15:23:30.123456789Z', 217178610123456789n],
['1976-11-18T15:23:30,12Z', 217178610120000000n],
['1976-11-18T15:23:30.12\u221202:00', 217185810120000000n],
['\u2212009999-11-18T15:23:30.12Z', -377677326989880000000n],
['1976-11-18T15:23:30.12-02:00', 217185810120000000n],
['-009999-11-18T15:23:30.12Z', -377677326989880000000n],
['19761118T15:23:30.1+00:00', 217178610100000000n],
['1976-11-18T152330.1+00:00', 217178610100000000n],
['1976-11-18T15:23:30.1+0000', 217178610100000000n],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (C) 2024 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-temporal.instant.prototype.equals
description: Non-ASCII minus sign is not acceptable
features: [Temporal]
---*/

const invalidStrings = [
"1976-11-18T15:23:30.12\u221202:00",
"\u2212009999-11-18T15:23:30.12",
];
const instance = new Temporal.Instant(0n);
invalidStrings.forEach((arg) => {
assert.throws(
RangeError,
() => instance.equals(arg),
`variant minus sign: ${arg}`
);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (C) 2024 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-temporal.instant.prototype.since
description: Non-ASCII minus sign is not acceptable
features: [Temporal]
---*/

const invalidStrings = [
"1976-11-18T15:23:30.12\u221202:00",
"\u2212009999-11-18T15:23:30.12",
];
const instance = new Temporal.Instant(0n);
invalidStrings.forEach((arg) => {
assert.throws(
RangeError,
() => instance.since(arg),
`variant minus sign: ${arg}`
);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (C) 2024 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-temporal.instant.prototype.until
description: Non-ASCII minus sign is not acceptable
features: [Temporal]
---*/

const invalidStrings = [
"1976-11-18T15:23:30.12\u221202:00",
"\u2212009999-11-18T15:23:30.12",
];
const instance = new Temporal.Instant(0n);
invalidStrings.forEach((arg) => {
assert.throws(
RangeError,
() => instance.until(arg),
`variant minus sign: ${arg}`
);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright (C) 2024 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: Non-ASCII minus sign is not acceptable
features: [Temporal]
---*/

const invalidStrings = [
"1976-11-18T15:23:30.12\u221202:00",
"\u2212009999-11-18T15:23:30.12",
];

invalidStrings.forEach((arg) => {
assert.throws(
RangeError,
() => Temporal.PlainDate.compare(arg, new Temporal.PlainDate(1976, 11, 18)),
`variant minus sign: ${arg} (first argument)`
);

assert.throws(
RangeError,
() => Temporal.PlainDate.compare(new Temporal.PlainDate(1976, 11, 18), arg),
`variant minus sign: ${arg} (second argument)`
);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (C) 2024 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-temporal.plaindate.from
description: Non-ASCII minus sign is not acceptable
features: [Temporal]
---*/

const invalidStrings = [
"1976-11-18T15:23:30.12\u221202:00",
"\u2212009999-11-18T15:23:30.12",
];

invalidStrings.forEach((arg) => {
assert.throws(
RangeError,
() => Temporal.PlainDate.from(arg),
`variant minus sign: ${arg}`
);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (C) 2024 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-temporal.plaindate.prototype.equals
description: Non-ASCII minus sign is not acceptable
features: [Temporal]
---*/

const invalidStrings = [
"1976-11-18T15:23:30.12\u221202:00",
"\u2212009999-11-18T15:23:30.12",
];
const instance = new Temporal.PlainDate(2000, 5, 2);
invalidStrings.forEach((arg) => {
assert.throws(
RangeError,
() => instance.equals(arg),
`variant minus sign: ${arg}`
);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (C) 2024 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-temporal.plaindate.prototype.since
description: Non-ASCII minus sign is not acceptable
features: [Temporal]
---*/

const invalidStrings = [
"1976-11-18T15:23:30.12\u221202:00",
"\u2212009999-11-18T15:23:30.12",
];
const instance = new Temporal.PlainDate(2000, 5, 2);
invalidStrings.forEach((arg) => {
assert.throws(
RangeError,
() => instance.since(arg),
`variant minus sign: ${arg}`
);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (C) 2024 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-temporal.plaindate.prototype.toplaindatetime
description: Non-ASCII minus sign is not acceptable
features: [Temporal]
---*/

const invalidStrings = [
"1976-11-18T15:23:30.12\u221202:00",
"\u2212009999-11-18T15:23:30.12",
];
const instance = new Temporal.PlainDate(2000, 5, 2);
invalidStrings.forEach((arg) => {
assert.throws(
RangeError,
() => instance.toPlainDateTime(arg),
`variant minus sign: ${arg}`
);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (C) 2024 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-temporal.plaindate.prototype.tozoneddatetime
description: Non-ASCII minus sign is not acceptable
features: [Temporal]
---*/

const invalidStrings = [
"1976-11-18T15:23:30.12\u221202:00",
"\u2212009999-11-18T15:23:30.12",
];
const instance = new Temporal.PlainDate(2000, 5, 2);
invalidStrings.forEach((arg) => {
assert.throws(
RangeError,
() => instance.toZonedDateTime({ plainTime: arg, timeZone: "UTC" }),
`variant minus sign: ${arg}`
);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (C) 2024 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-temporal.plaindate.prototype.until
description: Non-ASCII minus sign is not acceptable
features: [Temporal]
---*/

const invalidStrings = [
"1976-11-18T15:23:30.12\u221202:00",
"\u2212009999-11-18T15:23:30.12",
];
const instance = new Temporal.PlainDate(2000, 5, 2);
invalidStrings.forEach((arg) => {
assert.throws(
RangeError,
() => instance.until(arg),
`variant minus sign: ${arg}`
);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright (C) 2024 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-temporal.plaindatetime.compare
description: Non-ASCII minus sign is not acceptable
features: [Temporal]
---*/

const invalidStrings = [
"1976-11-18T15:23:30.12\u221202:00",
"\u2212009999-11-18T15:23:30.12",
];

invalidStrings.forEach((arg) => {
assert.throws(
RangeError,
() => Temporal.PlainDateTime.compare(arg, new Temporal.PlainDateTime(1976, 11, 18)),
`variant minus sign: ${arg} (first argument)`
);

assert.throws(
RangeError,
() => Temporal.PlainDateTime.compare(new Temporal.PlainDateTime(1976, 11, 18), arg),
`variant minus sign: ${arg} (second argument)`
);
});
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// Copyright (C) 2024 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-temporal.plaindatetime.from
description: Non-ASCII minus sign is acceptable
description: Non-ASCII minus sign is not acceptable
features: [Temporal]
includes: [temporalHelpers.js]
---*/

TemporalHelpers.assertPlainDateTime(
Temporal.PlainDateTime.from("1976-11-18T15:23:30.12\u221202:00"),
1976, 11, "M11", 18, 15, 23, 30, 120, 0, 0,
"variant minus sign (offset)"
);
const invalidStrings = [
"1976-11-18T15:23:30.12\u221202:00",
"\u2212009999-11-18T15:23:30.12",
];

TemporalHelpers.assertPlainDateTime(
Temporal.PlainDateTime.from("\u2212009999-11-18T15:23:30.12"),
-9999, 11, "M11", 18, 15, 23, 30, 120, 0, 0,
"variant minus sign (leading minus)"
);
invalidStrings.forEach((arg) => {
assert.throws(
RangeError,
() => Temporal.PlainDateTime.from(arg),
`variant minus sign: ${arg}`
);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (C) 2024 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-temporal.plaindatetime.prototype.equals
description: Non-ASCII minus sign is not acceptable
features: [Temporal]
---*/

const invalidStrings = [
"1976-11-18T15:23:30.12\u221202:00",
"\u2212009999-11-18T15:23:30.12",
];
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
invalidStrings.forEach((arg) => {
assert.throws(
RangeError,
() => instance.equals(arg),
`variant minus sign: ${arg}`
);
});
Loading
Loading