Source code
Revision control
Copy as Markdown
Other Tools
// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
// 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.from
description: M13 month code is invalid for Islamic-tbla calendar (12-month calendar)
features: [Temporal, Intl.Era-monthcode]
---*/
// The Islamic-tbla calendar is a 12-month calendar and should not accept M13
const calendar = "islamic-tbla";
assert.throws(RangeError, () => {
Temporal.PlainMonthDay.from({ calendar, monthCode: "M13", day: 1 });
}, `M13 should not be a valid month code for ${calendar} calendar`);
// M13 should throw even with overflow: "constrain"
assert.throws(RangeError, () => {
Temporal.PlainMonthDay.from({ calendar, monthCode: "M13", day: 1 }, { overflow: "constrain" });
}, `M13 should not be valid for ${calendar} calendar even with constrain overflow`);
// M13 should throw with overflow: "reject"
assert.throws(RangeError, () => {
Temporal.PlainMonthDay.from({ calendar, monthCode: "M13", day: 1 }, { overflow: "reject" });
}, `M13 should not be valid for ${calendar} calendar with reject overflow`);
reportCompare(0, 0);