diff --git a/src/utils/Util.ts b/src/utils/Util.ts index 8b2c6d8..18f8e80 100644 --- a/src/utils/Util.ts +++ b/src/utils/Util.ts @@ -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; }