mirror of
https://github.com/tc39/test262.git
synced 2025-11-30 10:33:14 +01:00
Test that resolved MonthDay can have a different ordinal month
PR #4708 covered the second issue reported in <https://bugzilla.mozilla.org/show_bug.cgi?id=1999918>. Extend the test cases to also cover the first issue reported there.
This commit is contained in:
parent
a1f905d440
commit
334bb5db93
@ -51,3 +51,10 @@ assert.throws(
|
|||||||
() => Temporal.PlainMonthDay.from({ calendar: "chinese", year: 2020, monthCode: "M01", day: 32 }, { overflow: "reject" }),
|
() => Temporal.PlainMonthDay.from({ calendar: "chinese", year: 2020, monthCode: "M01", day: 32 }, { overflow: "reject" }),
|
||||||
"Out-of-range day throws RangeError when all required fields present"
|
"Out-of-range day throws RangeError when all required fields present"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// No RangeError if month is present and reference date has a different ordinal month.
|
||||||
|
var pmd = Temporal.PlainMonthDay.from({ calendar: "chinese", year: 2004, monthCode: "M04", month: 5, day: 1 });
|
||||||
|
var pd = Temporal.PlainDate.from(pmd.toString());
|
||||||
|
assert.sameValue(pmd.monthCode, "M04", "Temporal.PlainMonthDay monthCode");
|
||||||
|
assert.sameValue(pd.monthCode, "M04", "Temporal.PlainDate monthCode");
|
||||||
|
assert.sameValue(pd.month, 4, "Temporal.PlainDate ordinal month");
|
||||||
|
|||||||
@ -50,3 +50,10 @@ assert.throws(
|
|||||||
() => Temporal.PlainMonthDay.from({ calendar: "hebrew", year: 5784, monthCode: "M01", day: 32 }, { overflow: "reject" }),
|
() => Temporal.PlainMonthDay.from({ calendar: "hebrew", year: 5784, monthCode: "M01", day: 32 }, { overflow: "reject" }),
|
||||||
"Out-of-range day throws RangeError when all required fields present"
|
"Out-of-range day throws RangeError when all required fields present"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// No RangeError if month is present and reference date has a different ordinal month.
|
||||||
|
var pmd = Temporal.PlainMonthDay.from({ calendar: "hebrew", year: 5784, monthCode: "M06", month: 7, day: 1 });
|
||||||
|
var pd = Temporal.PlainDate.from(pmd.toString());
|
||||||
|
assert.sameValue(pmd.monthCode, "M06", "Temporal.PlainMonthDay monthCode");
|
||||||
|
assert.sameValue(pd.monthCode, "M06", "Temporal.PlainDate monthCode");
|
||||||
|
assert.sameValue(pd.month, 6, "Temporal.PlainDate ordinal month");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user