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

setMonth

import { setMonth } from "https://esm.sh/v135/date-fns@3.6.0/index.d.mts";
@example
// Set February to 1 September 2014:
const result = setMonth(new Date(2014, 8, 1), 1)
//=> Sat Feb 01 2014 00:00:00
function setMonth<DateType extends Date>(date: DateType | number | string, month: number): DateType;
§
setMonth<DateType extends Date>(date: DateType | number | string, month: number): DateType
[src]

§Type Parameters

§
DateType extends Date
[src]

§Parameters

§
date: DateType | number | string
[src]
  • The date to be changed
§
month: number
[src]
  • The month index to set (0-11)

§Return Type

§
DateType
[src]

The new date with the month set