UNPKG

996 BTypeScriptView Raw
1import type { ContextOptions, DateArg } from "./types.js";
2/**
3 * The {@link differenceInCalendarYears} function options.
4 */
5export interface DifferenceInCalendarYearsOptions
6 extends ContextOptions<Date> {}
7/**
8 * @name differenceInCalendarYears
9 * @category Year Helpers
10 * @summary Get the number of calendar years between the given dates.
11 *
12 * @description
13 * Get the number of calendar years between the given dates.
14 *
15 * @param laterDate - The later date
16 * @param earlierDate - The earlier date
17 * @param options - An object with options
18
19 * @returns The number of calendar years
20 *
21 * @example
22 * // How many calendar years are between 31 December 2013 and 11 February 2015?
23 * const result = differenceInCalendarYears(
24 * new Date(2015, 1, 11),
25 * new Date(2013, 11, 31)
26 * );
27 * //=> 2
28 */
29export declare function differenceInCalendarYears(
30 laterDate: DateArg<Date> & {},
31 earlierDate: DateArg<Date> & {},
32 options?: DifferenceInCalendarYearsOptions | undefined,
33): number;