differenceInMilliseconds.cjs 861 B

1234567891011121314151617181920212223242526272829
  1. "use strict";
  2. exports.differenceInMilliseconds = differenceInMilliseconds;
  3. var _index = require("./toDate.cjs");
  4. /**
  5. * @name differenceInMilliseconds
  6. * @category Millisecond Helpers
  7. * @summary Get the number of milliseconds between the given dates.
  8. *
  9. * @description
  10. * Get the number of milliseconds between the given dates.
  11. *
  12. * @param laterDate - The later date
  13. * @param earlierDate - The earlier date
  14. *
  15. * @returns The number of milliseconds
  16. *
  17. * @example
  18. * // How many milliseconds are between
  19. * // 2 July 2014 12:30:20.600 and 2 July 2014 12:30:21.700?
  20. * const result = differenceInMilliseconds(
  21. * new Date(2014, 6, 2, 12, 30, 21, 700),
  22. * new Date(2014, 6, 2, 12, 30, 20, 600)
  23. * )
  24. * //=> 1100
  25. */
  26. function differenceInMilliseconds(laterDate, earlierDate) {
  27. return +(0, _index.toDate)(laterDate) - +(0, _index.toDate)(earlierDate);
  28. }