differenceInQuarters.d.mts 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. import type { RoundingOptions } from "./types.js";
  2. /**
  3. * The {@link differenceInQuarters} function options.
  4. */
  5. export interface DifferenceInQuartersOptions extends RoundingOptions {}
  6. /**
  7. * @name differenceInQuarters
  8. * @category Quarter Helpers
  9. * @summary Get the number of quarters between the given dates.
  10. *
  11. * @description
  12. * Get the number of quarters between the given dates.
  13. *
  14. * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
  15. *
  16. * @param dateLeft - The later date
  17. * @param dateRight - The earlier date
  18. * @param options - An object with options.
  19. *
  20. * @returns The number of full quarters
  21. *
  22. * @example
  23. * // How many full quarters are between 31 December 2013 and 2 July 2014?
  24. * const result = differenceInQuarters(new Date(2014, 6, 2), new Date(2013, 11, 31))
  25. * //=> 2
  26. */
  27. export declare function differenceInQuarters<DateType extends Date>(
  28. dateLeft: DateType | number | string,
  29. dateRight: DateType | number | string,
  30. options?: DifferenceInQuartersOptions,
  31. ): number;