index.js 570 B

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