hoursToSeconds.cjs 573 B

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