Skip to main content
Module

x/date_fns/index.js>addYears

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

Examples

// Add 5 years to 1 September 2014: var result = addYears(new Date(2014, 8, 1), 5) //=> Sun Sep 01 2019 00:00:00

Parameters

dirtyDate
  • the date to be changed
dirtyAmount
  • the amount of years to be added. Positive decimals will be rounded using Math.floor, decimals less than zero will be rounded using Math.ceil.