differenceInCalendarYears.d.ts 996 B

123456789101112131415161718192021222324252627282930313233
  1. import type { ContextOptions, DateArg } from "./types.js";
  2. /**
  3. * The {@link differenceInCalendarYears} function options.
  4. */
  5. export 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. * @returns The number of calendar years
  19. *
  20. * @example
  21. * // How many calendar years are between 31 December 2013 and 11 February 2015?
  22. * const result = differenceInCalendarYears(
  23. * new Date(2015, 1, 11),
  24. * new Date(2013, 11, 31)
  25. * );
  26. * //=> 2
  27. */
  28. export declare function differenceInCalendarYears(
  29. laterDate: DateArg<Date> & {},
  30. earlierDate: DateArg<Date> & {},
  31. options?: DifferenceInCalendarYearsOptions | undefined,
  32. ): number;