Temporal.ZonedDateTime.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 thực thể Temporal.ZonedDateTime trả về một boolean cho biết liệu ngày này có nằm trong 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. Thuộc tính này 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êm thông tin chung và các ví dụ khác, hãy xem Temporal.PlainDate.prototype.inLeapYear.
Ví dụ
>Sử dụng inLeapYear
js
const dt = Temporal.ZonedDateTime.from("2021-07-01[America/New_York]");
console.log(dt.inLeapYear); // false
console.log(dt.daysInYear); // 365
console.log(dt.monthsInYear); // 12
Đặc tả
| Specification |
|---|
| Temporal> # sec-get-temporal.zoneddatetime.prototype.inleapyear> |
Tương thích trình duyệt
Xem thêm
Temporal.ZonedDateTimeTemporal.ZonedDateTime.prototype.with()Temporal.ZonedDateTime.prototype.add()Temporal.ZonedDateTime.prototype.subtract()Temporal.ZonedDateTime.prototype.yearTemporal.ZonedDateTime.prototype.daysInYearTemporal.ZonedDateTime.prototype.monthsInYearTemporal.PlainDate.prototype.inLeapYear