Return the start of a week for the given date.
The result will be in the local timezone.
Example
// The start of a week for 2 September 2014 11:55:00: constresult = startOfWeek(newDate(2014, 8, 2, 11, 55, 0)) //=> Sun Aug 31 2014 00:00:00
Example
// If the week starts on Monday, the start of the week for 2 September 2014 11:55:00: constresult = startOfWeek(newDate(2014, 8, 2, 11, 55, 0), { weekStartsOn:1 }) //=> Mon Sep 01 2014 00:00:00
The
Date
type, the function operates on. Gets inferred from passed arguments. Allows to use extensions likeUTCDate
.