UNPKG

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