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

differenceInCalendarYears

import { differenceInCalendarYears } from "https://esm.sh/v135/date-fns@3.6.0/index.d.mts";
@example
// How many calendar years are between 31 December 2013 and 11 February 2015?
const result = differenceInCalendarYears(
  new Date(2015, 1, 11),
  new Date(2013, 11, 31)
)
//=> 2
function differenceInCalendarYears<DateType extends Date>(dateLeft: DateType | number | string, dateRight: DateType | number | string): number;
§
differenceInCalendarYears<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 calendar years