Skip to content
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright (C) 2026 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-temporal.duration.compare
description: Fractional minutes or hours in time string in relativeTo option should throw RangeError
features: [Temporal]
---*/

const instance1 = new Temporal.Duration(1, 0, 0, 0, 24)
const instance2 = new Temporal.Duration(1, 0, 0, 0, 24)

const invalidStrings = [
["2025-04-03T05:07.123", "Fractional minutes"],
["2025-04-03T12.5", "Fractional hours"],
];

for (const [arg, description] of invalidStrings) {
assert.throws(
RangeError,
() => Temporal.Duration.compare(instance1, instance2, { relativeTo: arg }),
`${description} not allowed in time string`
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (C) 2026 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-temporal.duration.prototype.round
description: Fractional minutes or hours in time string in relativeTo option should throw RangeError
features: [Temporal]
---*/

const instance = new Temporal.Duration(1, 0, 0, 0, 24)

const invalidStrings = [
["2025-04-03T05:07.123", "Fractional minutes"],
["2025-04-03T12.5", "Fractional hours"],
];

for (const [arg, description] of invalidStrings) {
assert.throws(
RangeError,
() => instance.round({ largestUnit: "months", relativeTo: arg }),
`${description} not allowed in time string`
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (C) 2026 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-temporal.duration.prototype.total
description: Fractional minutes or hours in time string in relativeTo option should throw RangeError
features: [Temporal]
---*/

const instance = new Temporal.Duration(1, 0, 0, 0, 24)

const invalidStrings = [
["2025-04-03T05:07.123", "Fractional minutes"],
["2025-04-03T12.5", "Fractional hours"],
];

for (const [arg, description] of invalidStrings) {
assert.throws(
RangeError,
() => instance.total({ unit: "months", relativeTo: arg }),
`${description} not allowed in time string`
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright (C) 2026 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: Fractional minutes or hours in time string should throw RangeError
features: [Temporal]
---*/

const invalidStrings = [
["2025-04-03T05:07.123[CET]", "Fractional minutes"],
["2025-04-03T12.5[CET]", "Fractional hours"],
];

for (const [arg, description] of invalidStrings) {
assert.throws(
RangeError,
() => Temporal.Instant.compare(arg, new Temporal.Instant(0n)),
`${description} not allowed in time string (first argument)`
);
assert.throws(
RangeError,
() => Temporal.Instant.compare(new Temporal.Instant(0n), arg),
`${description} not allowed in time string (second argument)`
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (C) 2026 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: Fractional minutes or hours in time string should throw RangeError
features: [Temporal]
---*/

const invalidStrings = [
["2025-04-03T05:07.123[CET]", "Fractional minutes"],
["2025-04-03T12.5[CET]", "Fractional hours"],
];

for (const [arg, description] of invalidStrings) {
assert.throws(
RangeError,
() => Temporal.Instant.from(arg),
`${description} not allowed in time string`
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (C) 2026 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: Fractional minutes or hours in time string should throw RangeError
features: [Temporal]
---*/

const instance = new Temporal.Instant(0n)

const invalidStrings = [
["2025-04-03T05:07.123[CET]", "Fractional minutes"],
["2025-04-03T12.5[CET]", "Fractional hours"],
];

for (const [arg, description] of invalidStrings) {
assert.throws(
RangeError,
() => instance.equals(arg),
`${description} not allowed in time string`
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (C) 2026 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: Fractional minutes or hours in time string should throw RangeError
features: [Temporal]
---*/

const instance = new Temporal.Instant(0n)

const invalidStrings = [
["2025-04-03T05:07.123[CET]", "Fractional minutes"],
["2025-04-03T12.5[CET]", "Fractional hours"],
];

for (const [arg, description] of invalidStrings) {
assert.throws(
RangeError,
() => instance.since(arg),
`${description} not allowed in time string`
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (C) 2026 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: Fractional minutes or hours in time string should throw RangeError
features: [Temporal]
---*/

const instance = new Temporal.Instant(0n)

const invalidStrings = [
["2025-04-03T05:07.123[CET]", "Fractional minutes"],
["2025-04-03T12.5[CET]", "Fractional hours"],
];

for (const [arg, description] of invalidStrings) {
assert.throws(
RangeError,
() => instance.until(arg),
`${description} not allowed in time string`
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright (C) 2026 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: Fractional minutes or hours in time string should throw RangeError
features: [Temporal]
---*/

const invalidStrings = [
["2025-04-03T05:07.123", "Fractional minutes"],
["2025-04-03T12.5", "Fractional hours"],
];

for (const [arg, description] of invalidStrings) {
assert.throws(
RangeError,
() => Temporal.PlainDate.compare(arg, new Temporal.PlainDate(2025, 04, 03)),
`${description} not allowed in time string (first argument)`
);
assert.throws(
RangeError,
() => Temporal.PlainDate.compare(new Temporal.PlainDate(2025, 04, 03), arg),
`${description} not allowed in time string (second argument)`
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (C) 2026 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: Fractional minutes or hours in time string should throw RangeError
features: [Temporal]
---*/

const invalidStrings = [
["2025-04-03T05:07.123", "Fractional minutes"],
["2025-04-03T12.5", "Fractional hours"],
];

for (const [arg, description] of invalidStrings) {
assert.throws(
RangeError,
() => Temporal.PlainDate.from(arg),
`${description} not allowed in time string`
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (C) 2026 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: Fractional minutes or hours in time string should throw RangeError
features: [Temporal]
---*/

const instance = new Temporal.PlainDate(2000, 5, 2)

const invalidStrings = [
["2025-04-03T05:07.123", "Fractional minutes"],
["2025-04-03T12.5", "Fractional hours"],
];

for (const [arg, description] of invalidStrings) {
assert.throws(
RangeError,
() => instance.equals(arg),
`${description} not allowed in time string`
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (C) 2026 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: Fractional minutes or hours in time string should throw RangeError
features: [Temporal]
---*/

const instance = new Temporal.PlainDate(2000, 5, 2)

const invalidStrings = [
["2025-04-03T05:07.123", "Fractional minutes"],
["2025-04-03T12.5", "Fractional hours"],
];

for (const [arg, description] of invalidStrings) {
assert.throws(
RangeError,
() => instance.since(arg),
`${description} not allowed in time string`
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (C) 2026 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: Fractional minutes or hours in time string should throw RangeError
features: [Temporal]
---*/

const instance = new Temporal.PlainDate(2000, 5, 2)

const invalidStrings = [
["2025-04-03T05:07.123", "Fractional minutes"],
["2025-04-03T12.5", "Fractional hours"],
];

for (const [arg, description] of invalidStrings) {
assert.throws(
RangeError,
() => instance.until(arg),
`${description} not allowed in time string`
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright (C) 2026 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: Fractional minutes or hours in time string should throw RangeError
features: [Temporal]
---*/

const invalidStrings = [
["2025-04-03T05:07.123", "Fractional minutes"],
["2025-04-03T12.5", "Fractional hours"],
];

for (const [arg, description] of invalidStrings) {
assert.throws(
RangeError,
() => Temporal.PlainDateTime.compare(arg, new Temporal.PlainDateTime(2025, 04, 03, 20, 04, 03)),
`${description} not allowed in time string (first argument)`
);
assert.throws(
RangeError,
() => Temporal.PlainDateTime.compare(new Temporal.PlainDateTime(2025, 04, 03, 20, 04, 03), arg),
`${description} not allowed in time string (second argument)`
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (C) 2026 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: Fractional minutes or hours in time string should throw RangeError
features: [Temporal]
---*/

const invalidStrings = [
["2025-04-03T05:07.123", "Fractional minutes"],
["2025-04-03T12.5", "Fractional hours"],
];

for (const [arg, description] of invalidStrings) {
assert.throws(
RangeError,
() => Temporal.PlainDateTime.from(arg),
`${description} not allowed in time string`
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (C) 2026 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: Fractional minutes or hours in time string should throw RangeError
features: [Temporal]
---*/

const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321)

const invalidStrings = [
["2025-04-03T05:07.123", "Fractional minutes"],
["2025-04-03T12.5", "Fractional hours"],
];

for (const [arg, description] of invalidStrings) {
assert.throws(
RangeError,
() => instance.equals(arg),
`${description} not allowed in time string`
);
}
Loading