Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

setDate

import { setDate } from "https://esm.sh/v135/date-fns@3.6.0/index.d.mts";
@example
// Set the 30th day of the month to 1 September 2014:
const result = setDate(new Date(2014, 8, 1), 30)
//=> Tue Sep 30 2014 00:00:00
function setDate<DateType extends Date>(date: DateType | number | string, dayOfMonth: number): DateType;
§
setDate<DateType extends Date>(date: DateType | number | string, dayOfMonth: number): DateType
[src]

§Type Parameters

§
DateType extends Date
[src]

§Parameters

§
date: DateType | number | string
[src]
  • The date to be changed
§
dayOfMonth: number
[src]
  • The day of the month of the new date

§Return Type

§
DateType
[src]

The new date with the day of the month set