Source

dateTime/toHHMMSS.js

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var SECONS_IN_HOUR = 3600;
var SECONS_IN_MIN = 60;
var NUM_DIGITS = 10;
/**
 * References: https://stackoverflow.com/questions/6312993/javascript-seconds-to-time-string-with-format-hhmmss
 *
 * @param {Number} seconds
 * @category dateTime
 * @module toHHMMSS
 */
var toHHMMSS = function (seconds) {
    // Don't forget the second param
    var secNum = parseInt("".concat(seconds), 10);
    var hours = Math.floor(secNum / SECONS_IN_HOUR);
    var minutes = Math.floor((secNum - (hours * SECONS_IN_HOUR)) / SECONS_IN_MIN);
    var sec = secNum - (hours * SECONS_IN_HOUR) - (minutes * SECONS_IN_MIN);
    if (hours < NUM_DIGITS)
        hours = "0".concat(hours);
    if (minutes < NUM_DIGITS)
        minutes = "0".concat(minutes);
    if (sec < NUM_DIGITS)
        sec = "0".concat(sec);
    return "".concat(hours, ":").concat(minutes, ":").concat(sec);
};
exports.default = toHHMMSS;