mirror of
https://github.com/musix-org/musix-oss
synced 2024-12-23 16:13:18 +00:00
15 lines
546 B
JavaScript
15 lines
546 B
JavaScript
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);
|
|
|
|
hours = (hours < 10) ? "0" + hours : hours;
|
|
minutes = (minutes < 10) ? "0" + minutes : minutes;
|
|
seconds = (seconds < 10) ? "0" + seconds : seconds;
|
|
|
|
return `${hours}:${minutes}:${seconds}`;
|
|
} else if (format = "dd:hh:mm") {
|
|
|
|
}
|
|
} |