Remove moment and moment-duration-format

This commit is contained in:
Daniel Odendahl Jr
2017-08-30 22:14:24 +00:00
parent 158716a453
commit 7d1adaec39
14 changed files with 36 additions and 36 deletions
+12
View File
@@ -73,6 +73,18 @@ class Util {
const filtered = arr.filter(entry => entry.language.name === 'en');
return filtered[Math.floor(Math.random() * filtered.length)];
}
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}`
};
}
}
module.exports = Util;