Temporal.PlainDate.prototype.calendarId

Limited availability

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

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The calendarId accessor property of Temporal.PlainDate instances returns a string representing the calendar used to interpret the internal ISO 8601 date.

For a list of commonly supported values, see Intl.Locale.prototype.getCalendars().

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

Examples

Using calendarId

const date = Temporal.PlainDate.from("2021-07-01");
console.log(date.calendarId); // "iso8601"; default

const date2 = Temporal.PlainDate.from("2021-07-01[u-ca=chinese]");
console.log(date2.calendarId); // "chinese"

const date3 = date2.withCalendar("hebrew");
console.log(date3.calendarId); // "hebrew"

Specifications

Browser compatibility

Desktop Mobile Server
Chrome Edge Firefox Opera Safari Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet WebView Android Deno Node.js
calendarId No No No No No No No No No No No 1.40 No

See also

© 2005–2024 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/calendarId