Temporal.ZonedDateTime.prototype.inLeapYear
Temporal.ZonedDateTime 例項的 inLeapYear 訪問器屬性返回一個布林值,指示此日期是否在閏年。閏年是比平年擁有更多天數(因為閏日或閏月)的年份。它取決於日曆。
inLeapYear 的設定器為 undefined。你不能直接更改此屬性。
有關一般資訊和更多示例,請參見 Temporal.PlainDate.prototype.inLeapYear。
示例
使用 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
規範
| 規範 |
|---|
| Temporal # sec-get-temporal.zoneddatetime.prototype.inleapyear |
瀏覽器相容性
載入中…
另見
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