Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/date_fns/setYear/index.ts>default

date-fns Deno package
Very Popular
Latest
function default
import { default } from "https://deno.land/x/date_fns@v2.22.1/setYear/index.ts";

Examples

// Set year 2013 to 1 September 2014: const result = setYear(new Date(2014, 8, 1), 2013) //=> Sun Sep 01 2013 00:00:00

Parameters

dirtyDate: Date | number
  • the date to be changed
dirtyYear: number
  • the year of the new date

Returns

the new date with the year set