mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-24 02:15:10 +02:00
New duration
This commit is contained in:
+4
-9
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user