startOfTomorrow.cjs 977 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. "use strict";
  2. exports.startOfTomorrow = startOfTomorrow;
  3. var _index = require("./constructFrom.cjs");
  4. var _index2 = require("./constructNow.cjs");
  5. /**
  6. * The {@link startOfTomorrow} function options.
  7. */
  8. /**
  9. * @name startOfTomorrow
  10. * @category Day Helpers
  11. * @summary Return the start of tomorrow.
  12. * @pure false
  13. *
  14. * @typeParam ContextDate - The `Date` type of the context function.
  15. *
  16. * @param options - An object with options
  17. *
  18. * @returns The start of tomorrow
  19. *
  20. * @description
  21. * Return the start of tomorrow.
  22. *
  23. * @example
  24. * // If today is 6 October 2014:
  25. * const result = startOfTomorrow()
  26. * //=> Tue Oct 7 2014 00:00:00
  27. */
  28. function startOfTomorrow(options) {
  29. const now = (0, _index2.constructNow)(options?.in);
  30. const year = now.getFullYear();
  31. const month = now.getMonth();
  32. const day = now.getDate();
  33. const date = (0, _index.constructFrom)(options?.in, 0);
  34. date.setFullYear(year, month, day + 1);
  35. date.setHours(0, 0, 0, 0);
  36. return date;
  37. }