index.js 893 B

12345678910111213141516171819202122232425262728
  1. import addDays from "../addDays/index.js";
  2. import isSameDay from "../isSameDay/index.js";
  3. import requiredArgs from "../_lib/requiredArgs/index.js";
  4. /**
  5. * @name isTomorrow
  6. * @category Day Helpers
  7. * @summary Is the given date tomorrow?
  8. * @pure false
  9. *
  10. * @description
  11. * Is the given date tomorrow?
  12. *
  13. * > ⚠️ Please note that this function is not present in the FP submodule as
  14. * > it uses `Date.now()` internally hence impure and can't be safely curried.
  15. *
  16. * @param {Date|Number} date - the date to check
  17. * @returns {Boolean} the date is tomorrow
  18. * @throws {TypeError} 1 argument required
  19. *
  20. * @example
  21. * // If today is 6 October 2014, is 7 October 14:00:00 tomorrow?
  22. * const result = isTomorrow(new Date(2014, 9, 7, 14, 0))
  23. * //=> true
  24. */
  25. export default function isTomorrow(dirtyDate) {
  26. requiredArgs(1, arguments);
  27. return isSameDay(dirtyDate, addDays(Date.now(), 1));
  28. }