Temporal.PlainYearMonth.prototype.year
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
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
| Specification |
|---|
| 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