diff --git a/struct/funcs/msToTime.js b/struct/funcs/msToTime.js index 3df1cc9f..872771a7 100644 --- a/struct/funcs/msToTime.js +++ b/struct/funcs/msToTime.js @@ -1,17 +1,18 @@ module.exports = function msToTime(duration, format) { - var seconds = Math.floor((duration / 1000) % 60), - minutes = Math.floor((duration / (1000 * 60)) % 60), - hours = Math.floor((duration / (1000 * 60 * 60)) % 24); - days = Math.floor((duration / (1000 * 60 * 60 * 24)) % 24); + var seconds = Math.floor((duration / 1000) % 60), + minutes = Math.floor((duration / (1000 * 60)) % 60), + hours = Math.floor((duration / (1000 * 60 * 60)) % 24); + days = Math.floor((duration / (1000 * 60 * 60 * 24)) % 24); - days = (days < 10) ? "0" + days : days; - hours = (hours < 10) ? "0" + hours : hours; - minutes = (minutes < 10) ? "0" + minutes : minutes; - seconds = (seconds < 10) ? "0" + seconds : seconds; + days = (days < 10) ? "0" + days : days; + hours = (hours < 10) ? "0" + hours : hours; + minutes = (minutes < 10) ? "0" + minutes : minutes; + seconds = (seconds < 10) ? "0" + seconds : seconds; - if (format = "hh:mm:ss") { + if (format === "hh:mm:ss") { + console.log(format) return `${hours}:${minutes}:${seconds}`; - } else if (format = "dd:hh:mm:ss") { + } else if (format === "dd:hh:mm:ss") { return `${days}:${hours}:${minutes}:${seconds}`; } }