Skip to content

Commit 5c62968

Browse files
committed
Temporal: Update PlainMonthDay-related tests
As of tc39/proposal-temporal#2500 , year is always optional for the ISO 8601 calendar.
1 parent 6396ebd commit 5c62968

File tree

9 files changed

+152
-167
lines changed

9 files changed

+152
-167
lines changed

harness/temporalHelpers.js

+25
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ features: [Symbol.species, Symbol.iterator, Temporal]
99

1010
const ASCII_IDENTIFIER = /^[$_a-zA-Z][$_a-zA-Z0-9]*$/u;
1111

12+
let nonDefaultCalendarId = undefined;
13+
try {
14+
nonDefaultCalendarId = Temporal.Calendar.from("hebrew").id;
15+
} catch (err) {}
16+
1217
function formatPropertyName(propertyKey, objectName = "") {
1318
switch (typeof propertyKey) {
1419
case "symbol":
@@ -36,6 +41,26 @@ function formatPropertyName(propertyKey, objectName = "") {
3641
const SKIP_SYMBOL = Symbol("Skip");
3742

3843
var TemporalHelpers = {
44+
nonDefaultCalendarId,
45+
46+
/*
47+
* Codes and maximum lengths of months in the ISO 8601 calendar.
48+
*/
49+
ISOMonths: [
50+
{ month: 1, monthCode: "M01", daysInMonth: 31 },
51+
{ month: 2, monthCode: "M02", daysInMonth: 29 },
52+
{ month: 3, monthCode: "M03", daysInMonth: 31 },
53+
{ month: 4, monthCode: "M04", daysInMonth: 30 },
54+
{ month: 5, monthCode: "M05", daysInMonth: 31 },
55+
{ month: 6, monthCode: "M06", daysInMonth: 30 },
56+
{ month: 7, monthCode: "M07", daysInMonth: 31 },
57+
{ month: 8, monthCode: "M08", daysInMonth: 31 },
58+
{ month: 9, monthCode: "M09", daysInMonth: 30 },
59+
{ month: 10, monthCode: "M10", daysInMonth: 31 },
60+
{ month: 11, monthCode: "M11", daysInMonth: 30 },
61+
{ month: 12, monthCode: "M12", daysInMonth: 31 }
62+
],
63+
3964
/*
4065
* assertDuration(duration, years, ..., nanoseconds[, description]):
4166
*

test/built-ins/Temporal/Calendar/prototype/monthDayFromFields/basic.js

+25-17
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,39 @@ info: |
1010
3. Assert: calendar.[[Identifier]] is "iso8601".
1111
4. If Type(fields) is not Object, throw a TypeError exception.
1212
5. Set options to ? GetOptionsObject(options).
13-
6. Let result be ? ISOMonthDayFromFields(fields, options).
14-
7. Return ? CreateTemporalMonthDay(result.[[Month]], result.[[Day]], calendar, result.[[ReferenceISOYear]]).
13+
6. Set fields to ? PrepareTemporalFields(fields, « "day", "month", "monthCode", "year" », « "day" »).
14+
7. Let overflow be ? ToTemporalOverflow(options).
15+
8. Perform ? ISOResolveMonth(fields).
16+
9. Let result be ? ISOMonthDayFromFields(fields, overflow).
17+
10. Return ? CreateTemporalMonthDay(result.[[Month]], result.[[Day]], "iso8601", result.[[ReferenceISOYear]]).
1518
includes: [temporalHelpers.js]
1619
features: [Temporal]
1720
---*/
1821

1922
const cal = new Temporal.Calendar("iso8601");
2023

21-
let result = cal.monthDayFromFields({ year: 2021, month: 7, day: 3 });
22-
TemporalHelpers.assertPlainMonthDay(result, "M07", 3, "month 7, day 3, with year");
23-
result = cal.monthDayFromFields({ year: 2021, month: 12, day: 31 });
24-
TemporalHelpers.assertPlainMonthDay(result, "M12", 31, "month 12, day 31, with year");
25-
result = cal.monthDayFromFields({ monthCode: "M07", day: 3 });
26-
TemporalHelpers.assertPlainMonthDay(result, "M07", 3, "monthCode M07, day 3");
27-
result = cal.monthDayFromFields({ monthCode: "M12", day: 31 });
28-
TemporalHelpers.assertPlainMonthDay(result, "M12", 31, "monthCode M12, day 31");
29-
30-
["constrain", "reject"].forEach(function (overflow) {
31-
const opt = { overflow };
24+
const options = [
25+
{ overflow: "constrain" },
26+
{ overflow: "reject" },
27+
{},
28+
undefined,
29+
];
30+
options.forEach((opt) => {
31+
const optionsDesc = opt && JSON.stringify(opt);
3232
result = cal.monthDayFromFields({ year: 2021, month: 7, day: 3 }, opt);
33-
TemporalHelpers.assertPlainMonthDay(result, "M07", 3, "month 7, day 3, with year");
33+
TemporalHelpers.assertPlainMonthDay(result, "M07", 3, `month 7, day 3, with year, options = ${optionsDesc}`);
3434
result = cal.monthDayFromFields({ year: 2021, month: 12, day: 31 }, opt);
35-
TemporalHelpers.assertPlainMonthDay(result, "M12", 31, "month 12, day 31, with year");
35+
TemporalHelpers.assertPlainMonthDay(result, "M12", 31, `month 12, day 31, with year, options = ${optionsDesc}`);
3636
result = cal.monthDayFromFields({ monthCode: "M07", day: 3 }, opt);
37-
TemporalHelpers.assertPlainMonthDay(result, "M07", 3, "monthCode M07, day 3");
37+
TemporalHelpers.assertPlainMonthDay(result, "M07", 3, `monthCode M07, day 3, options = ${optionsDesc}`);
3838
result = cal.monthDayFromFields({ monthCode: "M12", day: 31 }, opt);
39-
TemporalHelpers.assertPlainMonthDay(result, "M12", 31, "monthCode M12, day 31");
39+
TemporalHelpers.assertPlainMonthDay(result, "M12", 31, `monthCode M12, day 31, options = ${optionsDesc}`);
40+
});
41+
42+
TemporalHelpers.ISOMonths.forEach(({ month, monthCode, daysInMonth }) => {
43+
result = cal.monthDayFromFields({ month, day: daysInMonth });
44+
TemporalHelpers.assertPlainMonthDay(result, monthCode, daysInMonth, `month ${month}, day ${daysInMonth}`);
45+
46+
result = cal.monthDayFromFields({ monthCode, day: daysInMonth });
47+
TemporalHelpers.assertPlainMonthDay(result, monthCode, daysInMonth, `monthCode ${monthCode}, day ${daysInMonth}`);
4048
});

test/built-ins/Temporal/Calendar/prototype/monthDayFromFields/fields-missing-properties.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,19 @@ info: |
1010
3. Assert: calendar.[[Identifier]] is "iso8601".
1111
4. If Type(fields) is not Object, throw a TypeError exception.
1212
5. Set options to ? GetOptionsObject(options).
13-
6. Let result be ? ISOMonthDayFromFields(fields, options).
14-
7. Return ? CreateTemporalMonthDay(result.[[Month]], result.[[Day]], calendar, result.[[ReferenceISOYear]]).
13+
6. Set fields to ? PrepareTemporalFields(fields, « "day", "month", "monthCode", "year" », « "day" »).
14+
7. Let overflow be ? ToTemporalOverflow(options).
15+
8. Perform ? ISOResolveMonth(fields).
16+
9. Let result be ? ISOMonthDayFromFields(fields, overflow).
17+
10. Return ? CreateTemporalMonthDay(result.[[Month]], result.[[Day]], "iso8601", result.[[ReferenceISOYear]]).
1518
features: [Temporal]
1619
---*/
1720

1821
let cal = new Temporal.Calendar("iso8601")
1922

2023
assert.throws(TypeError, () => cal.monthDayFromFields({}), "at least one correctly spelled property is required");
24+
assert.throws(TypeError, () => cal.monthDayFromFields({ month: 12 }), "day is required with month");
2125
assert.throws(TypeError, () => cal.monthDayFromFields({ monthCode: "M12" }), "day is required with monthCode");
2226
assert.throws(TypeError, () => cal.monthDayFromFields({ year: 2021, month: 12 }), "day is required with year and month");
23-
assert.throws(TypeError, () => cal.monthDayFromFields({ month: 1, day: 17 }), "year is required if month is present");
27+
assert.throws(TypeError, () => cal.monthDayFromFields({ year: 2021, monthCode: "M12" }), "day is required with year and monthCode");
2428
assert.throws(TypeError, () => cal.monthDayFromFields({ year: 2021, day: 17 }), "either month or monthCode is required");

test/built-ins/Temporal/Calendar/prototype/monthDayFromFields/missing-properties.js

+15-14
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
/*---
55
esid: sec-temporal.calendar.prototype.monthdayfromfields
66
description: Errors due to missing properties on fields object are thrown in the correct order
7-
includes: [temporalHelpers.js]
7+
includes: [compareArray.js, temporalHelpers.js]
88
features: [Temporal]
99
---*/
1010

@@ -23,20 +23,21 @@ const missingDay = {
2323
};
2424
assert.throws(TypeError, () => instance.monthDayFromFields(missingDay), "day should be checked before year and month");
2525

26-
let getMonthCode = false;
27-
let getYear = false;
28-
const monthWithoutYear = {
29-
day: 1,
30-
month: 5,
26+
let got = [];
27+
const fieldsSpy = {
28+
get year() {
29+
got.push("year");
30+
},
31+
get month() {
32+
got.push("month");
33+
},
3134
get monthCode() {
32-
getMonthCode = true;
35+
got.push("monthCode");
3336
},
34-
get year() {
35-
getYear = true;
37+
get day() {
38+
got.push("day");
39+
return 1;
3640
},
3741
};
38-
assert.throws(TypeError, () => instance.monthDayFromFields(monthWithoutYear), "year/month should be checked after fetching but before resolving the month code");
39-
assert(getMonthCode, "year/month is checked after fetching monthCode");
40-
assert(getYear, "year/month is fetched after fetching month");
41-
42-
assert.throws(TypeError, () => instance.monthDayFromFields({ day: 1 }), "month should be resolved last");
42+
assert.throws(TypeError, () => instance.monthDayFromFields(fieldsSpy), "incomplete fields should be rejected (but after reading all non-required fields)");
43+
assert.compareArray(got, ["day", "month", "monthCode", "year"], "fields should be read in alphabetical order");

test/built-ins/Temporal/Calendar/prototype/monthDayFromFields/overflow-constrain.js

+43-69
Original file line numberDiff line numberDiff line change
@@ -10,82 +10,56 @@ info: |
1010
3. Assert: calendar.[[Identifier]] is "iso8601".
1111
4. If Type(fields) is not Object, throw a TypeError exception.
1212
5. Set options to ? GetOptionsObject(options).
13-
6. Let result be ? ISOMonthDayFromFields(fields, options).
14-
7. Return ? CreateTemporalMonthDay(result.[[Month]], result.[[Day]], calendar, result.[[ReferenceISOYear]]).
13+
6. Set fields to ? PrepareTemporalFields(fields, « "day", "month", "monthCode", "year" », « "day" »).
14+
7. Let overflow be ? ToTemporalOverflow(options).
15+
8. Perform ? ISOResolveMonth(fields).
16+
9. Let result be ? ISOMonthDayFromFields(fields, overflow).
17+
10. Return ? CreateTemporalMonthDay(result.[[Month]], result.[[Day]], "iso8601", result.[[ReferenceISOYear]]).
1518
includes: [temporalHelpers.js]
1619
features: [Temporal]
1720
---*/
1821

1922
const cal = new Temporal.Calendar("iso8601");
2023
const opt = { overflow: "constrain" };
2124

22-
let result = cal.monthDayFromFields({ year: 2021, month: 1, day: 133 }, opt);
23-
TemporalHelpers.assertPlainMonthDay(result, "M01", 31, "day is constrained to 31 in month 1");
24-
result = cal.monthDayFromFields({ year: 2021, month: 2, day: 133 }, opt);
25-
TemporalHelpers.assertPlainMonthDay(result, "M02", 28, "day is constrained to 28 in month 2 (year 2021)");
26-
result = cal.monthDayFromFields({ year: 2021, month: 3, day: 9033 }, opt);
27-
TemporalHelpers.assertPlainMonthDay(result, "M03", 31, "day is constrained to 31 in month 3");
28-
result = cal.monthDayFromFields({ year: 2021, month: 4, day: 50 }, opt);
29-
TemporalHelpers.assertPlainMonthDay(result, "M04", 30, "day is constrained to 30 in month 4");
30-
result = cal.monthDayFromFields({ year: 2021, month: 5, day: 77 }, opt);
31-
TemporalHelpers.assertPlainMonthDay(result, "M05", 31, "day is constrained to 31 in month 5");
32-
result = cal.monthDayFromFields({ year: 2021, month: 6, day: 33 }, opt);
33-
TemporalHelpers.assertPlainMonthDay(result, "M06", 30, "day is constrained to 30 in month 6");
34-
result = cal.monthDayFromFields({ year: 2021, month: 7, day: 33 }, opt);
35-
TemporalHelpers.assertPlainMonthDay(result, "M07", 31, "day is constrained to 31 in month 7");
36-
result = cal.monthDayFromFields({ year: 2021, month: 8, day: 300 }, opt);
37-
TemporalHelpers.assertPlainMonthDay(result, "M08", 31, "day is constrained to 31 in month 8");
38-
result = cal.monthDayFromFields({ year: 2021, month: 9, day: 400 }, opt);
39-
TemporalHelpers.assertPlainMonthDay(result, "M09", 30, "day is constrained to 30 in month 9");
40-
result = cal.monthDayFromFields({ year: 2021, month: 10, day: 400 }, opt);
41-
TemporalHelpers.assertPlainMonthDay(result, "M10", 31, "day is constrained to 31 in month 10");
42-
result = cal.monthDayFromFields({ year: 2021, month: 11, day: 400 }, opt);
43-
TemporalHelpers.assertPlainMonthDay(result, "M11", 30, "day is constrained to 30 in month 11");
44-
result = cal.monthDayFromFields({ year: 2021, month: 12, day: 500 }, opt);
45-
TemporalHelpers.assertPlainMonthDay(result, "M12", 31, "day is constrained to 31 in month 12");
46-
47-
assert.throws(
48-
RangeError,
49-
() => cal.monthDayFromFields({ year: 2021, month: -99999, day: 1 }, opt),
50-
"negative month -99999 is out of range even with overflow constrain"
51-
)
52-
assert.throws(
53-
RangeError,
54-
() => cal.monthDayFromFields({ year: 2021, month: -1, day: 1 }, opt),
55-
"negative month -1 is out of range even with overflow constrain"
56-
)
57-
assert.throws(
58-
RangeError,
59-
() => cal.monthDayFromFields({ year: 2021, month: 0, day: 1 }, opt),
60-
"month zero is out of range even with overflow constrain"
61-
)
62-
63-
result = cal.monthDayFromFields({ year: 2021, month: 13, day: 1 }, opt);
25+
let result = cal.monthDayFromFields({ year: 2021, month: 13, day: 1 }, opt);
6426
TemporalHelpers.assertPlainMonthDay(result, "M12", 1, "month 13 is constrained to 12");
27+
6528
result = cal.monthDayFromFields({ year: 2021, month: 999999, day: 500 }, opt);
66-
TemporalHelpers.assertPlainMonthDay(result, "M12", 31, "month 999999 is constrained to 12 and day constrained to 31");
29+
TemporalHelpers.assertPlainMonthDay(result, "M12", 31, "month 999999 is constrained to 12 and day 500 is constrained to 31");
30+
31+
[-99999, -1, 0].forEach((month) => {
32+
assert.throws(
33+
RangeError,
34+
() => cal.monthDayFromFields({ year: 2021, month, day: 1 }, opt),
35+
`Month ${month} is out of range for 2021 even with overflow: constrain`
36+
);
37+
});
38+
39+
TemporalHelpers.ISOMonths.forEach(({ month, monthCode, daysInMonth }) => {
40+
const day = daysInMonth + 1;
41+
42+
result = cal.monthDayFromFields({ month, day }, opt);
43+
TemporalHelpers.assertPlainMonthDay(result, monthCode, daysInMonth,
44+
`day is constrained from ${day} to ${daysInMonth} in month ${month}`);
45+
46+
result = cal.monthDayFromFields({ month, day: 9001 }, opt);
47+
TemporalHelpers.assertPlainMonthDay(result, monthCode, daysInMonth,
48+
`day is constrained to ${daysInMonth} in month ${month}`);
49+
50+
result = cal.monthDayFromFields({ monthCode, day }, opt);
51+
TemporalHelpers.assertPlainMonthDay(result, monthCode, daysInMonth,
52+
`day is constrained from ${day} to ${daysInMonth} in monthCode ${monthCode}`);
53+
54+
result = cal.monthDayFromFields({ monthCode, day: 9001 }, opt);
55+
TemporalHelpers.assertPlainMonthDay(result, monthCode, daysInMonth,
56+
`day is constrained to ${daysInMonth} in monthCode ${monthCode}`);
57+
});
58+
59+
[ ["month", 2], ["monthCode", "M02"] ].forEach(([ name, value ]) => {
60+
result = cal.monthDayFromFields({ year: 2020, [name]: value, day: 30 }, opt);
61+
TemporalHelpers.assertPlainMonthDay(result, "M02", 29, `${name} ${value} is constrained to 29 in leap year 2020`);
6762

68-
result = cal.monthDayFromFields({ monthCode: "M01", day: 133 }, opt);
69-
TemporalHelpers.assertPlainMonthDay(result, "M01", 31, "day is constrained to 31 in monthCode M01");
70-
result = cal.monthDayFromFields({ monthCode: "M02", day: 133 }, opt);
71-
TemporalHelpers.assertPlainMonthDay(result, "M02", 29, "day is constrained to 29 in monthCode M02");
72-
result = cal.monthDayFromFields({ monthCode: "M03", day: 9033 }, opt);
73-
TemporalHelpers.assertPlainMonthDay(result, "M03", 31, "day is constrained to 31 in monthCode M03");
74-
result = cal.monthDayFromFields({ monthCode: "M04", day: 50 }, opt);
75-
TemporalHelpers.assertPlainMonthDay(result, "M04", 30, "day is constrained to 30 in monthCode M04");
76-
result = cal.monthDayFromFields({ monthCode: "M05", day: 77 }, opt);
77-
TemporalHelpers.assertPlainMonthDay(result, "M05", 31, "day is constrained to 31 in monthCode M05");
78-
result = cal.monthDayFromFields({ monthCode: "M06", day: 33 }, opt);
79-
TemporalHelpers.assertPlainMonthDay(result, "M06", 30, "day is constrained to 30 in monthCode M06");
80-
result = cal.monthDayFromFields({ monthCode: "M07", day: 33 }, opt);
81-
TemporalHelpers.assertPlainMonthDay(result, "M07", 31, "day is constrained to 31 in monthCode M07");
82-
result = cal.monthDayFromFields({ monthCode: "M08", day: 300 }, opt);
83-
TemporalHelpers.assertPlainMonthDay(result, "M08", 31, "day is constrained to 31 in monthCode M08");
84-
result = cal.monthDayFromFields({ monthCode: "M09", day: 400 }, opt);
85-
TemporalHelpers.assertPlainMonthDay(result, "M09", 30, "day is constrained to 30 in monthCode M09");
86-
result = cal.monthDayFromFields({ monthCode: "M10", day: 400 }, opt);
87-
TemporalHelpers.assertPlainMonthDay(result, "M10", 31, "day is constrained to 31 in monthCode M10");
88-
result = cal.monthDayFromFields({ monthCode: "M11", day: 400 }, opt);
89-
TemporalHelpers.assertPlainMonthDay(result, "M11", 30, "day is constrained to 30 in monthCode M11");
90-
result = cal.monthDayFromFields({ monthCode: "M12", day: 500 }, opt);
91-
TemporalHelpers.assertPlainMonthDay(result, "M12", 31, "day is constrained to 31 in monthCode M12");
63+
result = cal.monthDayFromFields({ year: 2021, [name]: value, day: 29 }, opt);
64+
TemporalHelpers.assertPlainMonthDay(result, "M02", 28, `${name} ${value} is constrained to 28 in common year 2021`);
65+
});

test/built-ins/Temporal/Calendar/prototype/monthDayFromFields/overflow-reject.js

+24-26
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ info: |
1010
3. Assert: calendar.[[Identifier]] is "iso8601".
1111
4. If Type(fields) is not Object, throw a TypeError exception.
1212
5. Set options to ? GetOptionsObject(options).
13-
6. Let result be ? ISOMonthDayFromFields(fields, options).
14-
7. Return ? CreateTemporalMonthDay(result.[[Month]], result.[[Day]], calendar, result.[[ReferenceISOYear]]).
13+
6. Set fields to ? PrepareTemporalFields(fields, « "day", "month", "monthCode", "year" », « "day" »).
14+
7. Let overflow be ? ToTemporalOverflow(options).
15+
8. Perform ? ISOResolveMonth(fields).
16+
9. Let result be ? ISOMonthDayFromFields(fields, overflow).
17+
10. Return ? CreateTemporalMonthDay(result.[[Month]], result.[[Day]], "iso8601", result.[[ReferenceISOYear]]).
18+
includes: [temporalHelpers.js]
1519
features: [Temporal]
1620
---*/
1721

@@ -38,27 +42,21 @@ const cal = new Temporal.Calendar("iso8601");
3842
);
3943
});
4044

41-
assert.throws(RangeError, () => cal.monthDayFromFields(
42-
{ monthCode: "M01", day: 32 }, { overflow: "reject" }), "Day 32 is out of range for monthCode M01");
43-
assert.throws(RangeError, () => cal.monthDayFromFields(
44-
{ monthCode: "M02", day: 30 }, { overflow: "reject" }), "Day 30 is out of range for monthCode M02");
45-
assert.throws(RangeError, () => cal.monthDayFromFields(
46-
{ monthCode: "M03", day: 32 }, { overflow: "reject" }), "Day 32 is out of range for monthCode M03");
47-
assert.throws(RangeError, () => cal.monthDayFromFields(
48-
{ monthCode: "M04", day: 31 }, { overflow: "reject" }), "Day 31 is out of range for monthCode M04");
49-
assert.throws(RangeError, () => cal.monthDayFromFields(
50-
{ monthCode: "M05", day: 32 }, { overflow: "reject" }), "Day 32 is out of range for monthCode M05");
51-
assert.throws(RangeError, () => cal.monthDayFromFields(
52-
{ monthCode: "M06", day: 31 }, { overflow: "reject" }), "Day 31 is out of range for monthCode M06");
53-
assert.throws(RangeError, () => cal.monthDayFromFields(
54-
{ monthCode: "M07", day: 32 }, { overflow: "reject" }), "Day 32 is out of range for monthCode M07");
55-
assert.throws(RangeError, () => cal.monthDayFromFields(
56-
{ monthCode: "M08", day: 32 }, { overflow: "reject" }), "Day 32 is out of range for monthCode M08");
57-
assert.throws(RangeError, () => cal.monthDayFromFields(
58-
{ monthCode: "M09", day: 31 }, { overflow: "reject" }), "Day 31 is out of range for monthCode M09");
59-
assert.throws(RangeError, () => cal.monthDayFromFields(
60-
{ monthCode: "M10", day: 32 }, { overflow: "reject" }), "Day 32 is out of range for monthCode M10");
61-
assert.throws(RangeError, () => cal.monthDayFromFields(
62-
{ monthCode: "M11", day: 31 }, { overflow: "reject" }), "Day 31 is out of range for monthCode M11");
63-
assert.throws(RangeError, () => cal.monthDayFromFields(
64-
{ monthCode: "M12", day: 32 }, { overflow: "reject" }), "Day 32 is out of range for monthCode M12");
45+
TemporalHelpers.ISOMonths.forEach(({ month, monthCode, daysInMonth }) => {
46+
const day = daysInMonth + 1;
47+
assert.throws(RangeError,
48+
() => cal.monthDayFromFields({ month, day }, { overflow: "reject" }),
49+
`Day ${day} is out of range for month ${month} with overflow: reject`);
50+
assert.throws(RangeError,
51+
() => cal.monthDayFromFields({ monthCode, day }, { overflow: "reject" }),
52+
`Day ${day} is out of range for monthCode ${monthCode} with overflow: reject`);
53+
});
54+
55+
[ ["month", 2], ["monthCode", "M02"] ].forEach(([ name, value ]) => {
56+
assert.throws(RangeError,
57+
() => cal.monthDayFromFields({ year: 2020, [name]: value, day: 30 }, { overflow: "reject" }),
58+
`Day 30 is out of range for ${name} ${value} in leap year 2020 with overflow: reject`);
59+
assert.throws(RangeError,
60+
() => cal.monthDayFromFields({ year: 2021, [name]: value, day: 29 }, { overflow: "reject" }),
61+
`Day 29 is out of range for ${name} ${value} in common year 2021 with overflow: reject`);
62+
});

0 commit comments

Comments
 (0)