isTomorrow.js 878 B

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