Skip to content
Open
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
11 changes: 11 additions & 0 deletions test/built-ins/Temporal/PlainDate/from/negative-month-or-day.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright (C) 2025 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-temporal.plaindate.prototype.from
description: Months and days must be non-negative integers
features: [Temporal]
---*/

assert.throws(RangeError, () => Temporal.PlainDate.from({ year: 2000, day: 1, month: -1 }));
assert.throws(RangeError, () => Temporal.PlainDate.from({ year: 2000, month: 1, day: -1 }));
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright (C) 2025 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-temporal.plaindatetime.prototype.from
description: Months and days must be non-negative integers
features: [Temporal]
---*/

assert.throws(RangeError, () => Temporal.PlainDateTime.from({ year: 2000, day: 1, month: -1 }));
assert.throws(RangeError, () => Temporal.PlainDateTime.from({ year: 2000, month: 1, day: -1 }));
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright (C) 2025 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-temporal.plainmonthday.prototype.from
description: Months and days must be non-negative integers
features: [Temporal]
---*/

assert.throws(RangeError, () => Temporal.PlainMonthDay.from({ day: 1, month: -1 }));
assert.throws(RangeError, () => Temporal.PlainMonthDay.from({ month: 1, day: -1 }));
10 changes: 10 additions & 0 deletions test/built-ins/Temporal/PlainYearMonth/from/negative-month.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright (C) 2025 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-temporal.plainyearmonth.prototype.from
description: Months must be non-negative integers
features: [Temporal]
---*/

assert.throws(RangeError, () => Temporal.PlainYearMonth.from({ year: 1, month: -1 }));
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright (C) 2025 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-temporal.zoneddatetime.prototype.from
description: Months and days must be non-negative integers
features: [Temporal]
---*/

assert.throws(RangeError, () => Temporal.ZonedDateTime.from({ year: 2000, day: 1, timeZone: "UTC", month: -1 }));
assert.throws(RangeError, () => Temporal.ZonedDateTime.from({ year: 2000, month: 1, timeZone: "UTC", day: -1 }));