Temporal.PlainDate.prototype.daysInYear
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 daysInYear
Zugriffsobjekteigenschaft von Temporal.PlainDate
Instanzen gibt eine positive ganze Zahl zurück, die die Anzahl der Tage im Jahr dieses Datums darstellt. Sie ist abhängig vom Kalender.
Für den ISO 8601 Kalender sind dies 365 oder 366 in einem Schaltjahr. In anderen Kalendersystemen unterscheidet sich die Anzahl der Tage wahrscheinlich, insbesondere in nicht-solaren Kalendern.
Der Set-Zugriff von daysInWeek
ist undefined
. Sie können diese Eigenschaft nicht direkt ändern.
Beispiele
Verwendung von daysInYear
const date = Temporal.PlainDate.from("2021-07-01");
console.log(date.daysInYear); // 365
const date2 = Temporal.PlainDate.from("2020-07-01");
console.log(date2.daysInYear); // 366; 2020 is a leap year
const date3 = Temporal.PlainDate.from("2021-07-01[u-ca=chinese]");
console.log(date3.daysInYear); // 354
const date4 = Temporal.PlainDate.from("2023-07-01[u-ca=chinese]");
console.log(date4.daysInYear); // 384; 2023 is a Chinese leap year
Spezifikationen
Specification |
---|
Temporal proposal # sec-get-temporal.plaindate.prototype.daysinyear |
Browser-Kompatibilität
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
daysInYear |
Legend
Tip: you can click/tap on a cell for more information.
- No support
- No support
- Experimental. Expect behavior to change in the future.
- See implementation notes.
- User must explicitly enable this feature.