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

Temporal: Update test for monthDayFromFields() #3835

Merged
merged 1 commit into from
Aug 21, 2023
Merged
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
Expand Up @@ -16,8 +16,14 @@ features: [Temporal]

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

let result = cal.monthDayFromFields({ year: 2021, monthCode: "M02", day: 29 });
TemporalHelpers.assertPlainMonthDay(result, "M02", 29, "year is ignored and reference year should be a leap year if monthCode is given");
let result = cal.monthDayFromFields({ year: 2021, monthCode: "M02", day: 29} , { overflow: "constrain" });
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" });
TemporalHelpers.assertPlainMonthDay(result, "M02", 28, "year should not be ignored if monthCode is not given (overflow constrain)");
Expand Down