Temporal.PlainYearMonth.prototype.inLeapYear
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Thuộc tính truy cập inLeapYear của các thực thể Temporal.PlainYearMonth trả về một boolean cho biết year-month này có thuộc năm nhuận hay không. Năm nhuận là năm có nhiều ngày hơn (do ngày nhuận hoặc tháng nhuận) so với năm thường. Nó phụ thuộc vào lịch.
Set accessor của inLeapYear là undefined. Bạn không thể thay đổi thuộc tính này trực tiếp.
Để biết thông tin chung và thêm ví dụ, xem Temporal.PlainDate.prototype.inLeapYear.
Ví dụ
>Sử dụng inLeapYear
js
const ym = Temporal.PlainYearMonth.from("2021-07");
console.log(ym.inLeapYear); // false
console.log(ym.daysInYear); // 365
console.log(ym.monthsInYear); // 12
Đặc tả
| Specification |
|---|
| Temporal> # sec-get-temporal.plainyearmonth.prototype.inleapyear> |
Tương thích trình duyệt
Xem thêm
Temporal.PlainYearMonthTemporal.PlainYearMonth.prototype.with()Temporal.PlainYearMonth.prototype.add()Temporal.PlainYearMonth.prototype.subtract()Temporal.PlainYearMonth.prototype.yearTemporal.PlainYearMonth.prototype.daysInYearTemporal.PlainYearMonth.prototype.monthsInYearTemporal.PlainDate.prototype.inLeapYear