isSameDay.d.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. /**
  2. * @name isSameDay
  3. * @category Day Helpers
  4. * @summary Are the given dates in the same day (and year and month)?
  5. *
  6. * @description
  7. * Are the given dates in the same day (and year and month)?
  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. * @returns The dates are in the same day (and year and month)
  14. *
  15. * @example
  16. * // Are 4 September 06:00:00 and 4 September 18:00:00 in the same day?
  17. * const result = isSameDay(new Date(2014, 8, 4, 6, 0), new Date(2014, 8, 4, 18, 0))
  18. * //=> true
  19. *
  20. * @example
  21. * // Are 4 September and 4 October in the same day?
  22. * const result = isSameDay(new Date(2014, 8, 4), new Date(2014, 9, 4))
  23. * //=> false
  24. *
  25. * @example
  26. * // Are 4 September, 2014 and 4 September, 2015 in the same day?
  27. * const result = isSameDay(new Date(2014, 8, 4), new Date(2015, 8, 4))
  28. * //=> false
  29. */
  30. export declare function isSameDay<DateType extends Date>(
  31. dateLeft: DateType | number | string,
  32. dateRight: DateType | number | string,
  33. ): boolean;