Temporal.PlainDate.prototype.calendarId
calendarId
访问器属性是 Temporal.PlainDate
实例,用于返回一个字符串,表示用于解释内部 ISO 8601 日期的 日历。
有关常用日历类型的列表,请参阅Intl.supportedValuesOf()
。
calendarId
的 set 访问器为 undefined
。您不能直接更改此属性。请使用 withCalendar()
方法创建一个具有所需新值的 Temporal.PlainDate
新对象。
示例
使用 calendarId
js
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"
规范
规范 |
---|
Temporal # sec-get-temporal.plaindate.prototype.calendarid |
浏览器兼容性
加载中…