Temporal.PlainDateTime.prototype.monthsInYear
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 monthsInYear của các instance Temporal.PlainDateTime trả về một số nguyên dương đại diện cho số tháng trong năm của ngày này. Nó phụ thuộc vào lịch.
Set accessor của monthsInYear 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.monthsInYear.
Ví dụ
>Sử dụng monthsInYear
js
const dt = Temporal.PlainDateTime.from("2021-07-01");
console.log(dt.monthsInYear); // 12
Đặc tả
| Specification |
|---|
| Temporal> # sec-get-temporal.plaindatetime.prototype.monthsinyear> |
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.monthTemporal.PlainDateTime.prototype.monthCodeTemporal.PlainDateTime.prototype.daysInMonthTemporal.PlainDate.prototype.monthsInYear