isSameDay.d.ts 1.2 KB

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