Temporal.PlainDate.prototype.year

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

The year accessor property of Temporal.PlainDate instances returns an integer representing the number of years of this date relative to the start of a calendar-specific epoch year. This property has the same function as the era/eraYear pair as a unique identifier of a year in a calendar. It is calendar-dependent.

Value

Usually year 1 is either the first year of the latest era or the ISO 8601 year 0001. Because year is relative to the start of the epoch year, not the epoch date, if the epoch is in the middle of the year (only known to happen for the japanese calendar), that year will have the same year value before and after the start date of the era (for the japanese calendar, year is the same as the ISO 8601 year).

All specified calendars have arithmetic years fully defined by the spec.

  • The following calendars have the same epoch year as ISO 8601: chinese, dangi, gregory, japanese, in which year: 1 corresponds to the ISO year 1.
  • The buddhist calendar uses the Buddhist epoch of 543 BCE, so year: 1 corresponds to the ISO year -542.
  • The coptic calendar uses the Coptic epoch of 284 CE, so year: 1 corresponds to the ISO year 284.
  • The ethioaa calendar uses the Anno Mundi epoch of 5493 BCE, so year: 1 corresponds to the ISO year -5492.
  • The ethiopic calendar uses the Ethiopic epoch of 8 CE, so year: 1 corresponds to the ISO year 8.
  • The hebrew calendar uses the Anno Mundi epoch of 3761 BCE, so year: 1 corresponds to the ISO year -3760.
  • The indian calendar uses the Śaka epoch of 79 CE, so year: 1 corresponds to the ISO year 79.
  • The following calendars use the Hijri epoch of 622 CE: islamic-civil, islamic-tbla, islamic-umalqura, persian, in which year: 1 corresponds to the ISO year 622.
  • The roc calendar uses the Minguo epoch of 1912 CE, so year: 1 corresponds to the ISO year 1912.

Note: For the chinese and dangi calendars, the CLDR data uses the Huangdi epoch of 2637 BCE by default, but Temporal defined it to use the ISO 8601 epoch for simplicity.

The set accessor of year is undefined. You cannot change this property directly. Use the with() method to create a new Temporal.PlainDate object with the desired new value.

Examples

Using year

js
const date = Temporal.PlainDate.from("2021-07-01"); // ISO 8601 calendar
console.log(date.year); // 2021

const date2 = Temporal.PlainDate.from("-002021-07-01");
console.log(date2.year); // -2021

const date3 = Temporal.PlainDate.from("2021-07-01[u-ca=japanese]");
console.log(date3.year); // 2021; although the Japanese calendar uses eras,
// there's no obvious "default era", so the year is the same as the ISO year

const date4 = Temporal.PlainDate.from("2021-07-01[u-ca=hebrew]");
console.log(date4.year); // 5781; the Hebrew calendar uses the Anno Mundi epoch, which starts in 3761 BC

Specifications

Specification
Temporal
# sec-get-temporal.plaindate.prototype.year

Browser compatibility

desktop mobile server
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Bun
Deno
Node.js
year
Chrome – Full support
Chrome 144 (Release date: 2026-01-13)
footnote Full support
Edge – Full support
Edge 144 (Release date: 2026-01-21)
footnote Full support
Firefox – Full support
Firefox 139 (Release date: 2025-05-27)
footnote Full support
Opera – Full support
Opera 128 (Release date: 2026-02-26)
footnote Full support
Safari – No support
Safari
footnote
footnote See bug 223166
Chrome Android – Full support
Chrome Android 144 (Release date: 2026-01-13)
footnote Full support
Firefox for Android – Full support
Firefox for Android 139 (Release date: 2025-05-27)
footnote Full support
Opera Android – Full support
Opera Android 95 (Release date: 2026-02-11)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote
footnote See bug 223166
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – Full support
WebView Android 144 (Release date: 2026-01-13)
footnote Full support
WebView on iOS – No support
WebView on iOS
footnote
footnote See bug 223166
Bun – No support
Bun
footnote No support
Deno – Full support
Deno 2.7 (Release date: 2026-02-25)
footnote Full support
Node.js – No support
Node.js
footnote No support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
See implementation notes.

See also