index.js 761 B

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