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.plaindate.from
description: Test valid leap months when resolving fields in hebrew calendar
features: [Temporal, Intl.Era-monthcode]
includes: [temporalHelpers.js]
---*/
const calendar = "hebrew";
// Valid leap month: Adar I 5779
TemporalHelpers.assertPlainDate(
Temporal.PlainDate.from({ year: 5779, month: 6, day: 1, calendar }),
5779, 6, "M05L", 1,
"Leap month resolved from month number",
"am", 5779);
TemporalHelpers.assertPlainDate(
Temporal.PlainDate.from({ year: 5779, monthCode: "M05L", day: 1, calendar }),
5779, 6, "M05L", 1,
"Leap month resolved from month code",
"am", 5779);
// Creating dates in later months in a leap year
TemporalHelpers.assertPlainDate(
Temporal.PlainDate.from({ year: 5779, month: 7, day: 1, calendar }),
5779, 7, "M06", 1,
"Month after leap month resolved from month number",
"am", 5779);
TemporalHelpers.assertPlainDate(
Temporal.PlainDate.from({ year: 5779, monthCode: "M06", day: 1, calendar }),
5779, 7, "M06", 1,
"Month after leap month resolved from month code",
"am", 5779);
reportCompare(0, 0);