isPast.cjs 530 B

12345678910111213141516171819202122232425
  1. "use strict";
  2. exports.isPast = isPast;
  3. var _index = require("./toDate.cjs");
  4. /**
  5. * @name isPast
  6. * @category Common Helpers
  7. * @summary Is the given date in the past?
  8. * @pure false
  9. *
  10. * @description
  11. * Is the given date in the past?
  12. *
  13. * @param date - The date to check
  14. *
  15. * @returns The date is in the past
  16. *
  17. * @example
  18. * // If today is 6 October 2014, is 2 July 2014 in the past?
  19. * const result = isPast(new Date(2014, 6, 2))
  20. * //=> true
  21. */
  22. function isPast(date) {
  23. return +(0, _index.toDate)(date) < Date.now();
  24. }