fix(Util): fix time code builder
This commit is contained in:
parent
bce34c9fc8
commit
2575e2ab72
1 changed files with 3 additions and 2 deletions
|
@ -43,11 +43,12 @@ class Util {
|
|||
const items = Object.keys(duration);
|
||||
const required = ["days", "hours", "minutes", "seconds"];
|
||||
|
||||
const parsed = items.filter((x) => required.includes(x)).map((m) => (duration[m as keyof TimeData] > 0 ? duration[m as keyof TimeData] : ""));
|
||||
const parsed = items.filter((x) => required.includes(x)).map((m) => duration[m as keyof TimeData]);
|
||||
const final = parsed
|
||||
.filter((x) => !!x)
|
||||
.slice(parsed.findIndex((x) => x !== 0))
|
||||
.map((x) => x.toString().padStart(2, "0"))
|
||||
.join(":");
|
||||
|
||||
return final.length <= 3 ? `0:${final.padStart(2, "0") || 0}` : final;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue