From a984cd3f50e1a27b035c24bffb0f82024d55e65d Mon Sep 17 00:00:00 2001 From: Androz2091 Date: Sat, 20 Feb 2021 15:28:06 +0100 Subject: [PATCH] :sparkles: Improve buildTimecode function --- src/Util.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Util.js b/src/Util.js index 9c731f0..92d9ccf 100644 --- a/src/Util.js +++ b/src/Util.js @@ -85,7 +85,7 @@ module.exports = class Util { const required = ['days', 'hours', 'minutes', 'seconds'] const parsed = items.filter(x => required.includes(x)).map(m => data[m] > 0 ? data[m] : '') - const final = parsed.filter(x => !!x).join(':') - return final.length <= 3 ? `0:${final.length === 1 ? `0${final}` : final || 0}` : final + const final = parsed.filter(x => !!x).map((x) => x.toString().padStart(2, '0')).join(':') + return final.length <= 3 ? `0:${final.padStart(2, '0') || 0}` : final } }