Temporal.PlainDate.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.PlainDate trả về một chuỗi đại diện cho lịch được sử dụng để diễn giải ngày ISO 8601 bên trong.
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 đối tượng Temporal.PlainDate mới với giá trị mong muốn.
Ví dụ
>Sử dụng calendarId
js
const date = Temporal.PlainDate.from("2021-07-01");
console.log(date.calendarId); // "iso8601"; mặc định
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"
Đặc tả
| Specification |
|---|
| Temporal> # sec-get-temporal.plaindate.prototype.calendarid> |