Skip to main content
Module

x/date_fns/index.js>subMonths

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

Examples

// Subtract 5 months from 1 February 2015: var result = subMonths(new Date(2015, 1, 1), 5) //=> Mon Sep 01 2014 00:00:00

Parameters

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