Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

differenceInMonths

import { differenceInMonths } from "https://esm.sh/v135/date-fns@3.6.0/index.d.mts";
@example
// How many full months are between 31 January 2014 and 1 September 2014?
const result = differenceInMonths(new Date(2014, 8, 1), new Date(2014, 0, 31))
//=> 7
function differenceInMonths<DateType extends Date>(dateLeft: DateType | number | string, dateRight: DateType | number | string): number;
§
differenceInMonths<DateType extends Date>(dateLeft: DateType | number | string, dateRight: DateType | number | string): number
[src]

§Type Parameters

§
DateType extends Date
[src]

§Parameters

§
dateLeft: DateType | number | string
[src]
  • The later date
§
dateRight: DateType | number | string
[src]
  • The earlier date

§Return Type

§
number
[src]

The number of full months