hoursToMilliseconds.cjs 623 B

123456789101112131415161718192021222324
  1. "use strict";
  2. exports.hoursToMilliseconds = hoursToMilliseconds;
  3. var _index = require("./constants.cjs");
  4. /**
  5. * @name hoursToMilliseconds
  6. * @category Conversion Helpers
  7. * @summary Convert hours to milliseconds.
  8. *
  9. * @description
  10. * Convert a number of hours to a full number of milliseconds.
  11. *
  12. * @param hours - number of hours to be converted
  13. *
  14. * @returns The number of hours converted to milliseconds
  15. *
  16. * @example
  17. * // Convert 2 hours to milliseconds:
  18. * const result = hoursToMilliseconds(2)
  19. * //=> 7200000
  20. */
  21. function hoursToMilliseconds(hours) {
  22. return Math.trunc(hours * _index.millisecondsInHour);
  23. }