Temporal.PlainYearMonth.prototype.year
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 year Zugriffs-Eigenschaft von Instanzen von Temporal.PlainYearMonth gibt eine Ganzzahl zurück, die die Anzahl der Jahre dieses Jahr-Monats relativ zum Beginn eines kalender-spezifischen Epoch-Jahres darstellt. Sie ist kalender-abhängig.
Der Set-Zugriff für 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
js
const ym = Temporal.PlainYearMonth.from("2021-07"); // ISO 8601 calendar
console.log(ym.year); // 2021
Spezifikationen
| Spezifikation |
|---|
| Temporal> # sec-get-temporal.plainyearmonth.prototype.year> |
Browser-Kompatibilität
Siehe auch
Temporal.PlainYearMonthTemporal.PlainYearMonth.prototype.with()Temporal.PlainYearMonth.prototype.add()Temporal.PlainYearMonth.prototype.subtract()Temporal.PlainYearMonth.prototype.eraTemporal.PlainYearMonth.prototype.eraYearTemporal.PlainYearMonth.prototype.monthTemporal.PlainDate.prototype.year