Very Popular
Latest
function default
import { default } from "https://dotland.deno.dev/x/date_fns@v2.22.1/subMonths/index.ts";

Examples

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

Parameters

dirtyDate: Date | number
  • the date to be changed
dirtyAmount: number
  • 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.

Returns

Date

the new date with the months subtracted