isAfter.cjs 693 B

12345678910111213141516171819202122232425
  1. "use strict";
  2. exports.isAfter = isAfter;
  3. var _index = require("./toDate.cjs");
  4. /**
  5. * @name isAfter
  6. * @category Common Helpers
  7. * @summary Is the first date after the second one?
  8. *
  9. * @description
  10. * Is the first date after the second one?
  11. *
  12. * @param date - The date that should be after the other one to return true
  13. * @param dateToCompare - The date to compare with
  14. *
  15. * @returns The first date is after the second date
  16. *
  17. * @example
  18. * // Is 10 July 1989 after 11 February 1987?
  19. * const result = isAfter(new Date(1989, 6, 10), new Date(1987, 1, 11))
  20. * //=> true
  21. */
  22. function isAfter(date, dateToCompare) {
  23. return +(0, _index.toDate)(date) > +(0, _index.toDate)(dateToCompare);
  24. }