isThisSecond.cjs 748 B

123456789101112131415161718192021222324252627
  1. "use strict";
  2. exports.isThisSecond = isThisSecond;
  3. var _index = require("./constructNow.cjs");
  4. var _index2 = require("./isSameSecond.cjs");
  5. /**
  6. * @name isThisSecond
  7. * @category Second Helpers
  8. * @summary Is the given date in the same second as the current date?
  9. * @pure false
  10. *
  11. * @description
  12. * Is the given date in the same second as the current date?
  13. *
  14. * @param date - The date to check
  15. *
  16. * @returns The date is in this second
  17. *
  18. * @example
  19. * // If now is 25 September 2014 18:30:15.500,
  20. * // is 25 September 2014 18:30:15.000 in this second?
  21. * const result = isThisSecond(new Date(2014, 8, 25, 18, 30, 15))
  22. * //=> true
  23. */
  24. function isThisSecond(date) {
  25. return (0, _index2.isSameSecond)(date, (0, _index.constructNow)(date));
  26. }