Skip to main content
Deno 2 is finally here 🎉️
Learn more
Very Popular
Latest
function default
import { default } from "https://deno.land/x/date_fns@v2.22.1/differenceInYears/index.ts";

Examples

// How many full years are between 31 December 2013 and 11 February 2015? const result = differenceInYears(new Date(2015, 1, 11), new Date(2013, 11, 31)) //=> 1

Parameters

dirtyDateLeft: Date | number
  • the later date
dirtyDateRight: Date | number
  • the earlier date

Returns

number

the number of full years