differenceInMonths.d.ts 847 B

1234567891011121314151617181920212223242526
  1. import type { ContextOptions, DateArg } from "./types.js";
  2. /**
  3. * The {@link differenceInMonths} function options.
  4. */
  5. export interface DifferenceInMonthsOptions extends ContextOptions<Date> {}
  6. /**
  7. * @name differenceInMonths
  8. * @category Month Helpers
  9. * @summary Get the number of full months between the given dates.
  10. *
  11. * @param laterDate - The later date
  12. * @param earlierDate - The earlier date
  13. * @param options - An object with options
  14. *
  15. * @returns The number of full months
  16. *
  17. * @example
  18. * // How many full months are between 31 January 2014 and 1 September 2014?
  19. * const result = differenceInMonths(new Date(2014, 8, 1), new Date(2014, 0, 31))
  20. * //=> 7
  21. */
  22. export declare function differenceInMonths(
  23. laterDate: DateArg<Date> & {},
  24. earlierDate: DateArg<Date> & {},
  25. options?: DifferenceInMonthsOptions | undefined,
  26. ): number;