New duration

This commit is contained in:
Daniel Odendahl Jr
2018-01-29 14:49:22 +00:00
parent 2856361cdc
commit 15650048d5
6 changed files with 11 additions and 18 deletions
+4 -9
View File
@@ -32,15 +32,10 @@ class Util {
}
static duration(ms) {
const sec = Math.floor((ms / 1000) % 60);
const min = Math.floor((ms / (1000 * 60)) % 60);
const hrs = Math.floor(ms / (1000 * 60 * 60));
return {
hours: hrs,
minutes: min,
seconds: sec,
format: () => `${hrs < 10 ? `0${hrs}` : hrs}:${min < 10 ? `0${min}` : min}:${sec < 10 ? `0${sec}` : sec}`
};
const sec = Math.floor((ms / 1000) % 60).toString();
const min = Math.floor((ms / (1000 * 60)) % 60).toString();
const hrs = Math.floor(ms / (1000 * 60 * 60)).toString();
return `${hrs.padStart(2, '0')}:${min.padStart(2, '0')}:${sec.padStart(2, '0')}`;
}
static randomRange(min, max) {