Temporal.PlainDateTime.prototype.monthsInYear
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimentell: Dies ist eine experimentelle Technologie
Überprüfen Sie die Browser-Kompatibilitätstabelle sorgfältig vor der Verwendung auf produktiven Webseiten.
Die Zugriffs-Eigenschaft monthsInYear von Temporal.PlainDateTime Instanzen gibt eine positive Ganzzahl zurück, die die Anzahl der Monate im Jahr dieses Datums darstellt. Sie ist kalenderabhängig.
Der Set-Accessor von monthsInYear ist undefined. Sie können diese Eigenschaft nicht direkt ändern.
Allgemeine Informationen und weitere Beispiele finden Sie unter Temporal.PlainDate.prototype.monthsInYear.
Beispiele
>Verwendung von monthsInYear
js
const dt = Temporal.PlainDateTime.from("2021-07-01");
console.log(dt.monthsInYear); // 12
Spezifikationen
| Specification |
|---|
| Temporal> # sec-get-temporal.plaindatetime.prototype.monthsinyear> |
Browser-Kompatibilität
Loading…
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