Temporal.PlainDateTime.prototype.calendarId
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Thuộc tính accessor calendarId của các instance Temporal.PlainDateTime trả về một chuỗi đại diện cho lịch được sử dụng để diễn giải ngày ISO 8601 nội bộ.
Xem Intl.supportedValuesOf() để biết danh sách các loại lịch thường được hỗ trợ.
Set accessor của calendarId là undefined. Bạn không thể thay đổi thuộc tính này trực tiếp. Sử dụng phương thức withCalendar() để tạo một đối tượng Temporal.PlainDateTime mới với giá trị mới mong muốn.
Ví dụ
>Sử dụng 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"
Đặc tả
| Specification |
|---|
| Temporal> # sec-get-temporal.plaindatetime.prototype.calendarid> |