mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-13 08:19:08 +02:00
Remove moment and moment-duration-format
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user