startOfWeek

Modified on Wed, 23 Aug 2023

Description

Use this function to obtain the start of a week for the given date. The result will be in the local timezone.

Syntax

startOfWeek(date, options)

Returns

Return ValueDescription
DateReturns a Date object representing the start of the week for the given date in the local timezone.

Sample

ExampleResultDescription
startOfWeek(2023-04-09, { weekStartsOn: 1 })2023-04-03Returns the start of the week for April 9, 2023, considering Monday as the first day of the week.

To view all the Date functions, click here.

See Also