isSameHour.d.ts 1.0 KB

1234567891011121314151617181920212223242526272829
  1. /**
  2. * @name isSameHour
  3. * @category Hour Helpers
  4. * @summary Are the given dates in the same hour (and same day)?
  5. *
  6. * @description
  7. * Are the given dates in the same hour (and same day)?
  8. *
  9. * @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).
  10. *
  11. * @param dateLeft - The first date to check
  12. * @param dateRight - The second date to check
  13. *
  14. * @returns The dates are in the same hour (and same day)
  15. *
  16. * @example
  17. * // Are 4 September 2014 06:00:00 and 4 September 06:30:00 in the same hour?
  18. * const result = isSameHour(new Date(2014, 8, 4, 6, 0), new Date(2014, 8, 4, 6, 30))
  19. * //=> true
  20. *
  21. * @example
  22. * // Are 4 September 2014 06:00:00 and 5 September 06:00:00 in the same hour?
  23. * const result = isSameHour(new Date(2014, 8, 4, 6, 0), new Date(2014, 8, 5, 6, 0))
  24. * //=> false
  25. */
  26. export declare function isSameHour<DateType extends Date>(
  27. dateLeft: DateType | number | string,
  28. dateRight: DateType | number | string,
  29. ): boolean;