Temporal.PlainDateTime.prototype.month
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 month
von Temporal.PlainDateTime
-Instanzen gibt eine positive ganze Zahl zurück, die den 1-basierten Monatsindex im Jahr dieses Datums darstellt. Der erste Monat dieses Jahres ist 1
, und der letzte Monat ist der monthsInYear
. Es ist kalenderabhängig (calendar).
Der Set-Accessor von month
ist undefined
. Sie können diese Eigenschaft nicht direkt ändern. Verwenden Sie die with()
-Methode, um ein neues Temporal.PlainDateTime
-Objekt mit dem gewünschten neuen Wert zu erstellen.
Für allgemeine Informationen und weitere Beispiele siehe Temporal.PlainDate.prototype.month
.
Beispiele
Verwendung von month
const dt = Temporal.PlainDateTime.from("2021-07-01"); // ISO 8601 calendar
console.log(dt.monthCode); // "M07"
console.log(dt.month); // 7
Spezifikationen
Specification |
---|
Temporal proposal # sec-get-temporal.plaindatetime.prototype.month |
Browser-Kompatibilität
BCD tables only load in the browser
Siehe auch
Temporal.PlainDateTime
Temporal.PlainDateTime.prototype.with()
Temporal.PlainDateTime.prototype.add()
Temporal.PlainDateTime.prototype.subtract()
Temporal.PlainDateTime.prototype.year
Temporal.PlainDateTime.prototype.day
Temporal.PlainDateTime.prototype.monthCode
Temporal.PlainDateTime.prototype.daysInMonth
Temporal.PlainDateTime.prototype.monthsInYear
Temporal.PlainDate.prototype.month