index.js 895 B

123456789101112131415161718192021222324252627282930313233343536
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = startOfTomorrow;
  6. /**
  7. * @name startOfTomorrow
  8. * @category Day Helpers
  9. * @summary Return the start of tomorrow.
  10. * @pure false
  11. *
  12. * @description
  13. * Return the start of tomorrow.
  14. *
  15. * > ⚠️ Please note that this function is not present in the FP submodule as
  16. * > it uses `new Date()` internally hence impure and can't be safely curried.
  17. *
  18. * @returns {Date} the start of tomorrow
  19. *
  20. * @example
  21. * // If today is 6 October 2014:
  22. * const result = startOfTomorrow()
  23. * //=> Tue Oct 7 2014 00:00:00
  24. */
  25. function startOfTomorrow() {
  26. var now = new Date();
  27. var year = now.getFullYear();
  28. var month = now.getMonth();
  29. var day = now.getDate();
  30. var date = new Date(0);
  31. date.setFullYear(year, month, day + 1);
  32. date.setHours(0, 0, 0, 0);
  33. return date;
  34. }
  35. module.exports = exports.default;