Temporal.PlainYearMonth.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 month
Accessor-Eigenschaft von Temporal.PlainYearMonth
Instanzen gibt eine positive ganze Zahl zurück, die den 1-basierten Monatsindex im Jahr dieses Jahr-Monats darstellt. Der erste Monat dieses Jahres ist 1
, und der letzte Monat ist der monthsInYear
. Es ist kalender-abhängig.
Der Set-Accessor von month
ist undefined
. Sie können diese Eigenschaft nicht direkt ändern. Verwenden Sie die with()
Methode, um ein neues Temporal.PlainYearMonth
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 ym = Temporal.PlainYearMonth.from("2021-07"); // ISO 8601 calendar
console.log(ym.monthCode); // "M07"
console.log(ym.month); // 7
Spezifikationen
Specification |
---|
Temporal proposal # sec-get-temporal.plainyearmonth.prototype.month |
Browser-Kompatibilität
BCD tables only load in the browser
Siehe auch
Temporal.PlainYearMonth
Temporal.PlainYearMonth.prototype.with()
Temporal.PlainYearMonth.prototype.add()
Temporal.PlainYearMonth.prototype.subtract()
Temporal.PlainYearMonth.prototype.year
Temporal.PlainYearMonth.prototype.monthCode
Temporal.PlainYearMonth.prototype.daysInMonth
Temporal.PlainYearMonth.prototype.monthsInYear
Temporal.PlainDate.prototype.month