JavaScript Temporal PlainYearMonth
Temporal.PlainYearMonth Object Reference
The Temporal.PlainYearMonth object is a year and month object.
It represents the year and month of an ISO 8601 calendar (without a day).
Example: 2025-05.
Example
// Create a PlainYearMonth object
const date = Temporal.PlainYearMonth.from("2026-05");
Try it Yourself »
New to JavaScript Temporal Dates?
Temporal.PlainYearMonth Methods
Revised March 2026
| Constructing | Description |
|---|---|
| from() | Creates a PlainYearMonth object from an object or a string |
| new (constructor) | Creates a PlainYearMonth object from integer parameters |
| Arithmetic | |
| add() | Returns a new PlainYearMonth with a duration added |
| subtract() | Returns a new PlainYearMonth with a duration subtracted |
| Comparing | |
| compare() | Returns -1, 0, or 1 from comparing two dates |
| equals() | Returns true if two dates are identical |
| since() | Returns the difference since another date |
| until() | Returns the difference until another date |
| Converting | |
| toPlainDate() | Returns a new PlainDate object |
| with() | Returns a new PlainYearMonth with fields modified |
| Formatting | |
| toJSON() | Returns an RFC 9557 format string for JSON serialization |
| toLocaleString() | Returns a language-sensitive representation of the date |
| toString() | Returns an RFC 9557 format string representation |
| valueOf() | TypeError (temporals cannot be converted to primitives) |
Temporal.PlainYearMonth Properties
| Property | Description |
|---|---|
| calendarID | Calendar system identifier ("iso8601") |
| daysInMonth | The total number of days in that month |
| daysInYear | The total number of days in that year |
| era | The era name of the calendar, if applicable ("gregory") |
| eraYear | The year within the era, if applicable |
| inLeapYear | A boolean indicating if the date falls in a leap year |
| month | The month as an integer (1-12) |
| monthCode | A calendar-specific string code for the month ("M01") |
| monthsInYear | The total number of months in that year |
| year | The year as an integer |
Display all PlainYearMonth Properties
const date = new Temporal.PlainYearMonth(2026, 5);
Try it Yourself »
Browser Support
Temporal is a major update to the JavaScript standard (TC39).
It is currently fully supported in Chrome, Edge, and Firefox, and is expected to reach full availability across browsers before the summer of 2026.
| Chrome 144 |
Edge 144 |
Firefox 139 |
Safari |
Opera |
| Jan 2026 | Jan 2026 | May 2025 | 🚫 | 🚫 |
Opera support will probably appear 1-3 browser cycles after Chromium, which often means a few months later.
The Safari implementation is in development and can be tested in Safari Technology Preview by enabling the --use-temporal runtime flag.
Polyfill
Until Opera and Safari support Temporal natively, you can use the official polyfill:
<script
src="https://cdn.jsdelivr.net/npm/@js-temporal/polyfill/dist/index.umd.js">
</script>