setDay
import { setDay } from "https://esm.sh/v135/date-fns@3.6.0/index.d.mts";
@example
// Set week day to Sunday, with the default weekStartsOn of Sunday:
const result = setDay(new Date(2014, 8, 1), 0)
//=> Sun Aug 31 2014 00:00:00
@example
// Set week day to Sunday, with a weekStartsOn of Monday:
const result = setDay(new Date(2014, 8, 1), 0, { weekStartsOn: 1 })
//=> Sun Sep 07 2014 00:00:00
function setDay<DateType extends Date>(
date: DateType | number | string,
day: number,
options?: SetDayOptions,
): DateType;§
setDay<DateType extends Date>(date: DateType | number | string, day: number, options?: SetDayOptions): DateType
[src]§Parameters
§
options?: SetDayOptions optional
[src]- An object with options.