isSameHour.d.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. import type { ContextOptions, DateArg } from "./types.js";
  2. /**
  3. * The {@link isSameHour} function options.
  4. */
  5. export interface IsSameHourOptions extends ContextOptions<Date> {}
  6. /**
  7. * @name isSameHour
  8. * @category Hour Helpers
  9. * @summary Are the given dates in the same hour (and same day)?
  10. *
  11. * @description
  12. * Are the given dates in the same hour (and same day)?
  13. *
  14. * @param dateLeft - The first date to check
  15. * @param dateRight - The second date to check
  16. * @param options - An object with options
  17. *
  18. * @returns The dates are in the same hour (and same day)
  19. *
  20. * @example
  21. * // Are 4 September 2014 06:00:00 and 4 September 06:30:00 in the same hour?
  22. * const result = isSameHour(new Date(2014, 8, 4, 6, 0), new Date(2014, 8, 4, 6, 30))
  23. * //=> true
  24. *
  25. * @example
  26. * // Are 4 September 2014 06:00:00 and 5 September 06:00:00 in the same hour?
  27. * const result = isSameHour(new Date(2014, 8, 4, 6, 0), new Date(2014, 8, 5, 6, 0))
  28. * //=> false
  29. */
  30. export declare function isSameHour(
  31. dateLeft: DateArg<Date> & {},
  32. dateRight: DateArg<Date> & {},
  33. options?: IsSameHourOptions | undefined,
  34. ): boolean;