endOfWeek

Commons
stable

Returns the last day of the ISO week containing the given date, respecting the locale's first-day-of-week setting. The input date is not mutated.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

date
required
Date
Any date within the target week.
locale
required
string
BCP 47 locale string (e.g. "en-US", "fr-FR"). The last two characters determine the first day of the week used to derive the last day.

API

Return value

The value returned by this util.

A new Date set to the last day of the week for the given locale.

Usage

Examples

Ready-to-paste usage snippets.

Last day of the week per locale

typescript