differenceInMinutes.d.cts 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import type { DateArg, RoundingOptions } from "./types.js";
  2. /**
  3. * The {@link differenceInMinutes} function options.
  4. */
  5. export interface DifferenceInMinutesOptions extends RoundingOptions {}
  6. /**
  7. * @name differenceInMinutes
  8. * @category Minute Helpers
  9. * @summary Get the number of minutes between the given dates.
  10. *
  11. * @description
  12. * Get the signed number of full (rounded towards 0) minutes between the given dates.
  13. *
  14. * @param dateLeft - The later date
  15. * @param dateRight - The earlier date
  16. * @param options - An object with options.
  17. *
  18. * @returns The number of minutes
  19. *
  20. * @example
  21. * // How many minutes are between 2 July 2014 12:07:59 and 2 July 2014 12:20:00?
  22. * const result = differenceInMinutes(
  23. * new Date(2014, 6, 2, 12, 20, 0),
  24. * new Date(2014, 6, 2, 12, 7, 59)
  25. * )
  26. * //=> 12
  27. *
  28. * @example
  29. * // How many minutes are between 10:01:59 and 10:00:00
  30. * const result = differenceInMinutes(
  31. * new Date(2000, 0, 1, 10, 0, 0),
  32. * new Date(2000, 0, 1, 10, 1, 59)
  33. * )
  34. * //=> -1
  35. */
  36. export declare function differenceInMinutes(
  37. dateLeft: DateArg<Date> & {},
  38. dateRight: DateArg<Date> & {},
  39. options?: DifferenceInMinutesOptions,
  40. ): number;