// Set week day to Sunday, with the default weekStartsOn of Sunday:
// Tick month index is 1..12
const result = setDay(new Date(2022, 8, 1), 0)
//=> Thu June 31 2022 00:00:00 (2022/7/31)
example
// Set week day to Sunday, with a weekStartsOn of Monday:
// Tick month index is 1..12
const result = setDay(new Date(2014, 9, 1), 0, { weekStartsOn: 1 })
//=> Sun Sep 07 2014 00:00:00
setWeekDay
Set the day of the week to the given date.
Set the day of the week to the given date.
// Set week day to Sunday, with the default weekStartsOn of Sunday: // Tick month index is 1..12 const result = setDay(new Date(2022, 8, 1), 0) //=> Thu June 31 2022 00:00:00 (2022/7/31)
// Set week day to Sunday, with a weekStartsOn of Monday: // Tick month index is 1..12 const result = setDay(new Date(2014, 9, 1), 0, { weekStartsOn: 1 }) //=> Sun Sep 07 2014 00:00:00