index.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. * ### v2.0.0 breaking changes:
  19. *
  20. * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
  21. *
  22. * @returns {Date} the start of tomorrow
  23. *
  24. * @example
  25. * // If today is 6 October 2014:
  26. * const result = startOfTomorrow()
  27. * //=> Tue Oct 7 2014 00:00:00
  28. */
  29. function startOfTomorrow() {
  30. var now = new Date();
  31. var year = now.getFullYear();
  32. var month = now.getMonth();
  33. var day = now.getDate();
  34. var date = new Date(0);
  35. date.setFullYear(year, month, day + 1);
  36. date.setHours(0, 0, 0, 0);
  37. return date;
  38. }
  39. module.exports = exports.default;