1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-11-10 11:20:19 +00:00
musix-oss/struct/funcs/msToTime.js

15 lines
546 B
JavaScript
Raw Normal View History

2020-02-10 19:04:42 +00:00
module.exports = function msToTime(duration, format) {
if (format = "hh:mm:ss") {
var seconds = Math.floor((duration / 1000) % 60),
minutes = Math.floor((duration / (1000 * 60)) % 60),
hours = Math.floor((duration / (1000 * 60 * 60)) % 24);
2020-02-05 20:02:53 +00:00
2020-02-10 19:04:42 +00:00
hours = (hours < 10) ? "0" + hours : hours;
minutes = (minutes < 10) ? "0" + minutes : minutes;
seconds = (seconds < 10) ? "0" + seconds : seconds;
2020-02-05 20:02:53 +00:00
2020-02-10 19:04:42 +00:00
return `${hours}:${minutes}:${seconds}`;
} else if (format = "dd:hh:mm") {
}
2020-02-05 20:02:53 +00:00
}