Temporal.PlainDateTime.prototype.inLeapYear
Temporal.PlainDateTime
实例的 inLeapYear
访问器属性返回一个布尔值,指示该日期是否在闰年。闰年是指比普通年份多一天(由于闰日或闰月)的年份。这是 日历相关属性。
inLeapYear
的设置器为 undefined
。你不能直接更改此属性。
有关一般信息和更多示例,请参见 Temporal.PlainDate.prototype.inLeapYear
。
示例
使用 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
规范
规范 |
---|
Temporal # sec-get-temporal.plaindatetime.prototype.inleapyear |
浏览器兼容性
加载中…
另见
Temporal.PlainDateTime
Temporal.PlainDateTime.prototype.with()
Temporal.PlainDateTime.prototype.add()
Temporal.PlainDateTime.prototype.subtract()
Temporal.PlainDateTime.prototype.year
Temporal.PlainDateTime.prototype.daysInYear
Temporal.PlainDateTime.prototype.monthsInYear
Temporal.PlainDate.prototype.inLeapYear