startOfTomorrow.js 645 B

12345678910111213141516171819202122232425262728
  1. "use strict";
  2. exports.startOfTomorrow = startOfTomorrow; /**
  3. * @name startOfTomorrow
  4. * @category Day Helpers
  5. * @summary Return the start of tomorrow.
  6. * @pure false
  7. *
  8. * @description
  9. * Return the start of tomorrow.
  10. *
  11. * @returns The start of tomorrow
  12. *
  13. * @example
  14. * // If today is 6 October 2014:
  15. * const result = startOfTomorrow()
  16. * //=> Tue Oct 7 2014 00:00:00
  17. */
  18. function startOfTomorrow() {
  19. const now = new Date();
  20. const year = now.getFullYear();
  21. const month = now.getMonth();
  22. const day = now.getDate();
  23. const date = new Date(0);
  24. date.setFullYear(year, month, day + 1);
  25. date.setHours(0, 0, 0, 0);
  26. return date;
  27. }