getWeek
Commons
stable
Returns the ISO-like week number (1–53) of a date, computed via the configured DateAdapter. The algorithm aligns with the ISO 8601 definition: weeks start on Monday and week 1 contains the first Thursday of the year.
API
Signature
Signature TypeScript complète, extraite du fichier util.
API
Paramètres
Paramètres d'entrée acceptés par cet util.
- adapterrequisDateAdapter
- The active date adapter instance. Provides the toJsDate() conversion so the function is date-library agnostic.
- valuerequisany
- A date value in the format understood by the adapter (native Date, ISO string, or library-specific object).
API
Valeur de retour
La valeur retournée par cet util.
- The week number (1–53) of the given date.
Usage
Exemples
Extraits de code prêts à coller.
Get week number with the native adapter