index.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = isTomorrow;
  6. var _index = _interopRequireDefault(require("../addDays/index.js"));
  7. var _index2 = _interopRequireDefault(require("../isSameDay/index.js"));
  8. var _index3 = _interopRequireDefault(require("../_lib/requiredArgs/index.js"));
  9. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10. /**
  11. * @name isTomorrow
  12. * @category Day Helpers
  13. * @summary Is the given date tomorrow?
  14. * @pure false
  15. *
  16. * @description
  17. * Is the given date tomorrow?
  18. *
  19. * > ⚠️ Please note that this function is not present in the FP submodule as
  20. * > it uses `Date.now()` internally hence impure and can't be safely curried.
  21. *
  22. * ### v2.0.0 breaking changes:
  23. *
  24. * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
  25. *
  26. * @param {Date|Number} date - the date to check
  27. * @returns {Boolean} the date is tomorrow
  28. * @throws {TypeError} 1 argument required
  29. *
  30. * @example
  31. * // If today is 6 October 2014, is 7 October 14:00:00 tomorrow?
  32. * var result = isTomorrow(new Date(2014, 9, 7, 14, 0))
  33. * //=> true
  34. */
  35. function isTomorrow(dirtyDate) {
  36. (0, _index3.default)(1, arguments);
  37. return (0, _index2.default)(dirtyDate, (0, _index.default)(Date.now(), 1));
  38. }
  39. module.exports = exports.default;