isoWeek
ISO 8601 week of a date: weeks start on Monday and week 1 is the one that contains the first Thursday of the year, so the first days of January can belong to week 52 or 53 of the previous year (and the last days of December to week 1 of the next).
The calendar day is read in UTC, so the result does not depend on the machine timezone.
Returns null if the input is invalid.
Available since v3.1.4
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
date | DateLike | The date to locate |
Returns
Section titled “Returns”object | null — The ISO week-numbering year and the week number (1–53), or null
Examples
Section titled “Examples”Week number of a date
Section titled “Week number of a date”Weeks start on Monday and week 1 contains the first Thursday of the year.
Year boundary
Section titled “Year boundary”The first days of January can belong to the last week of the previous year.
Invalid date
Section titled “Invalid date”Returns null instead of throwing.
Related Types
Section titled “Related Types”DateLike
Section titled “DateLike”A value that can be converted to a Date.
Date— used as-is (validated for Invalid Date)number— treated as a timestamp (seconds or milliseconds, auto-detected);0is treated as invalid and producesnullin ensureDatestring— parsed vianew Date(string)Temporal.Instant|Temporal.ZonedDateTime— read via theirepochMillisecondsproperty
