isSameSecond.d.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /**
  2. * @name isSameSecond
  3. * @category Second Helpers
  4. * @summary Are the given dates in the same second (and hour and day)?
  5. *
  6. * @description
  7. * Are the given dates in the same second (and hour and 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 second (and hour and day)
  15. *
  16. * @example
  17. * // Are 4 September 2014 06:30:15.000 and 4 September 2014 06:30.15.500 in the same second?
  18. * const result = isSameSecond(
  19. * new Date(2014, 8, 4, 6, 30, 15),
  20. * new Date(2014, 8, 4, 6, 30, 15, 500)
  21. * )
  22. * //=> true
  23. *
  24. * @example
  25. * // Are 4 September 2014 06:00:15.000 and 4 September 2014 06:01.15.000 in the same second?
  26. * const result = isSameSecond(
  27. * new Date(2014, 8, 4, 6, 0, 15),
  28. * new Date(2014, 8, 4, 6, 1, 15)
  29. * )
  30. * //=> false
  31. *
  32. * @example
  33. * // Are 4 September 2014 06:00:15.000 and 5 September 2014 06:00.15.000 in the same second?
  34. * const result = isSameSecond(
  35. * new Date(2014, 8, 4, 6, 0, 15),
  36. * new Date(2014, 8, 5, 6, 0, 15)
  37. * )
  38. * //=> false
  39. */
  40. export declare function isSameSecond<DateType extends Date>(
  41. dateLeft: DateType | number | string,
  42. dateRight: DateType | number | string,
  43. ): boolean;