Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/date_fns/index.js>setYear

date-fns Deno package
Very Popular
Go to Latest
function setYear
import { setYear } from "https://deno.land/x/date_fns@v2.0.0-alpha.35/index.js";

Examples

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

Parameters

dirtyDate
  • the date to be changed
dirtyYear
  • the year of the new date