Temporal.PlainDateTime.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 accessor inLeapYear của các instance Temporal.PlainDateTime trả về một giá trị boolean cho biết ngày này có trong năm nhuận 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 dt = Temporal.PlainDateTime.from("2021-07-01");
console.log(dt.inLeapYear); // false
console.log(dt.daysInYear); // 365
console.log(dt.monthsInYear); // 12
Đặc tả
| Specification |
|---|
| Temporal> # sec-get-temporal.plaindatetime.prototype.inleapyear> |
Tương thích trình duyệt
Xem thêm
Temporal.PlainDateTimeTemporal.PlainDateTime.prototype.with()Temporal.PlainDateTime.prototype.add()Temporal.PlainDateTime.prototype.subtract()Temporal.PlainDateTime.prototype.yearTemporal.PlainDateTime.prototype.daysInYearTemporal.PlainDateTime.prototype.monthsInYearTemporal.PlainDate.prototype.inLeapYear