Temporal.PlainDateTime.prototype.monthsInYear
Eingeschränkt verfügbar
Diese Funktion ist nicht Baseline, da sie in einigen der am weitesten verbreiteten Browser nicht funktioniert.
Want more support for this feature? Tell us why.
Die monthsInYear Accessor-Eigenschaft von Temporal.PlainDateTime Instanzen gibt eine positive ganze Zahl zurück, die die Anzahl der Monate im Jahr dieses Datums darstellt. Sie ist kalenderabhängig.
Der Setz-Accessor von monthsInYear ist undefined. Sie können diese Eigenschaft nicht direkt ändern.
Für allgemeine Informationen und weitere Beispiele siehe Temporal.PlainDate.prototype.monthsInYear.
Beispiele
>Verwendung von monthsInYear
js
const dt = Temporal.PlainDateTime.from("2021-07-01");
console.log(dt.monthsInYear); // 12
Spezifikationen
| Spezifikation |
|---|
| Temporal> # sec-get-temporal.plaindatetime.prototype.monthsinyear> |
Browser-Kompatibilität
Siehe auch
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