isToday.cjs 817 B

1234567891011121314151617181920212223242526272829303132333435
  1. "use strict";
  2. exports.isToday = isToday;
  3. var _index = require("./constructFrom.cjs");
  4. var _index2 = require("./constructNow.cjs");
  5. var _index3 = require("./isSameDay.cjs");
  6. /**
  7. * The {@link isToday} function options.
  8. */
  9. /**
  10. * @name isToday
  11. * @category Day Helpers
  12. * @summary Is the given date today?
  13. * @pure false
  14. *
  15. * @description
  16. * Is the given date today?
  17. *
  18. * @param date - The date to check
  19. * @param options - An object with options
  20. *
  21. * @returns The date is today
  22. *
  23. * @example
  24. * // If today is 6 October 2014, is 6 October 14:00:00 today?
  25. * const result = isToday(new Date(2014, 9, 6, 14, 0))
  26. * //=> true
  27. */
  28. function isToday(date, options) {
  29. return (0, _index3.isSameDay)(
  30. (0, _index.constructFrom)(options?.in || date, date),
  31. (0, _index2.constructNow)(options?.in || date),
  32. );
  33. }