startOfWeek
Commons
stable
Return a new Date rewound to the first day of the week containing the given date. The first day of week is derived from the locale (or from an explicit override).
API
Signature
Full TypeScript signature sourced from the util file.
API
Parameters
Input parameters accepted by this util.
- daterequiredDate
- The reference date. The function walks backwards until the weekday matches the first-day-of-week.
- localerequiredstring
- A BCP 47 locale string used to look up the first day of week (e.g. "en-US" → Sunday, "fr-FR" → Monday).
- firstDayOfWeeknumber
- Explicit override (0 = Sunday … 6 = Saturday). When provided, the locale lookup is skipped.
API
Return value
The value returned by this util.
- A new Date at the start of the week (same time as the input date).
Usage
Examples
Ready-to-paste usage snippets.
Find Monday from any day (fr-FR locale)