UNPKG

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