index.js 777 B

12345678910111213141516171819202122232425262728
  1. import startOfDay from "../startOfDay/index.js";
  2. /**
  3. * @name startOfToday
  4. * @category Day Helpers
  5. * @summary Return the start of today.
  6. * @pure false
  7. *
  8. * @description
  9. * Return the start of today.
  10. *
  11. * > ⚠️ Please note that this function is not present in the FP submodule as
  12. * > it uses `Date.now()` internally hence impure and can't be safely curried.
  13. *
  14. * ### v2.0.0 breaking changes:
  15. *
  16. * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
  17. *
  18. * @returns {Date} the start of today
  19. *
  20. * @example
  21. * // If today is 6 October 2014:
  22. * var result = startOfToday()
  23. * //=> Mon Oct 6 2014 00:00:00
  24. */
  25. export default function startOfToday() {
  26. return startOfDay(Date.now());
  27. }