Temporal.PlainYearMonth.prototype.year
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 year
Zugriffseigenschaft von Temporal.PlainYearMonth
Instanzen gibt eine ganze Zahl zurück, die die Anzahl der Jahre dieses Jahr-Monats relativ zum Beginn eines kalenderspezifischen Epochjahres darstellt. Sie ist abhängig vom Kalender.
Der set-Zugriff von year
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.year
.
Beispiele
Verwendung von year
const ym = Temporal.PlainYearMonth.from("2021-07"); // ISO 8601 calendar
console.log(ym.year); // 2021
Spezifikationen
Specification |
---|
Temporal # sec-get-temporal.plainyearmonth.prototype.year |
Browser-Kompatibilität
Siehe auch
Temporal.PlainYearMonth
Temporal.PlainYearMonth.prototype.with()
Temporal.PlainYearMonth.prototype.add()
Temporal.PlainYearMonth.prototype.subtract()
Temporal.PlainYearMonth.prototype.era
Temporal.PlainYearMonth.prototype.eraYear
Temporal.PlainYearMonth.prototype.month
Temporal.PlainDate.prototype.year