secondsToHours.cjs 702 B

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