Temporal.PlainDateTime.prototype.calendarId
calendarId 訪問器屬性是 Temporal.PlainDateTime 例項,返回一個字串,表示用於解釋內部 ISO 8601 日期的 日曆。
有關常用日曆型別的列表,請參閱Intl.supportedValuesOf()。
calendarId 的 set 訪問器是 undefined。您無法直接更改此屬性。請使用 withCalendar() 方法建立一個具有所需新值的 Temporal.PlainDateTime 物件。
示例
使用 calendarId
js
const dt = Temporal.PlainDateTime.from("2021-07-01T08:00:00");
console.log(dt.calendarId); // "iso8601"; default
const dt2 = Temporal.PlainDateTime.from("2021-07-01T08:00:00[u-ca=chinese]");
console.log(dt2.calendarId); // "chinese"
const dt3 = dt2.withCalendar("hebrew");
console.log(dt3.calendarId); // "hebrew"
規範
| 規範 |
|---|
| Temporal # sec-get-temporal.plaindatetime.prototype.calendarid |
瀏覽器相容性
載入中…