mirror of
https://github.com/tc39/test262.git
synced 2025-07-25 15:04:43 +02:00
Update test for monthDayFromFields()
This commit is contained in:
parent
c30aff08af
commit
bdddd9e2d2
@ -16,8 +16,14 @@ features: [Temporal]
|
|||||||
|
|
||||||
const cal = new Temporal.Calendar("iso8601");
|
const cal = new Temporal.Calendar("iso8601");
|
||||||
|
|
||||||
let result = cal.monthDayFromFields({ year: 2021, monthCode: "M02", day: 29 });
|
let result = cal.monthDayFromFields({ year: 2021, monthCode: "M02", day: 29} , { overflow: "constrain" });
|
||||||
TemporalHelpers.assertPlainMonthDay(result, "M02", 29, "year is ignored and reference year should be a leap year if monthCode is given");
|
TemporalHelpers.assertPlainMonthDay(result, "M02", 28, "year should not be ignored when monthCode is given (overflow constrain");
|
||||||
|
|
||||||
|
assert.throws(
|
||||||
|
RangeError,
|
||||||
|
() => cal.monthDayFromFields({ year: 2021, monthCode: "M02", day: 29 }, {overflow: "reject"}),
|
||||||
|
"year should not be ignored when monthCode is given (overflow reject)"
|
||||||
|
);
|
||||||
|
|
||||||
result = cal.monthDayFromFields({ year: 2021, month: 2, day: 29 }, { overflow: "constrain" });
|
result = cal.monthDayFromFields({ year: 2021, month: 2, day: 29 }, { overflow: "constrain" });
|
||||||
TemporalHelpers.assertPlainMonthDay(result, "M02", 28, "year should not be ignored if monthCode is not given (overflow constrain)");
|
TemporalHelpers.assertPlainMonthDay(result, "M02", 28, "year should not be ignored if monthCode is not given (overflow constrain)");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user