index.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. "use strict";
  2. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
  3. Object.defineProperty(exports, "__esModule", {
  4. value: true
  5. });
  6. exports.default = millisecondsToHours;
  7. var _index = _interopRequireDefault(require("../_lib/requiredArgs/index.js"));
  8. var _index2 = require("../constants/index.js");
  9. /**
  10. * @name millisecondsToHours
  11. * @category Conversion Helpers
  12. * @summary Convert milliseconds to hours.
  13. *
  14. * @description
  15. * Convert a number of milliseconds to a full number of hours.
  16. *
  17. * @param {number} milliseconds - number of milliseconds to be converted
  18. *
  19. * @returns {number} the number of milliseconds converted in hours
  20. * @throws {TypeError} 1 argument required
  21. *
  22. * @example
  23. * // Convert 7200000 milliseconds to hours:
  24. * const result = millisecondsToHours(7200000)
  25. * //=> 2
  26. *
  27. * @example
  28. * // It uses floor rounding:
  29. * const result = millisecondsToHours(7199999)
  30. * //=> 1
  31. */
  32. function millisecondsToHours(milliseconds) {
  33. (0, _index.default)(1, arguments);
  34. var hours = milliseconds / _index2.millisecondsInHour;
  35. return Math.floor(hours);
  36. }
  37. module.exports = exports.default;