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