✨ Improve buildTimecode function
This commit is contained in:
parent
0a2c2c2de8
commit
a984cd3f50
1 changed files with 2 additions and 2 deletions
|
@ -85,7 +85,7 @@ module.exports = class Util {
|
||||||
const required = ['days', 'hours', 'minutes', 'seconds']
|
const required = ['days', 'hours', 'minutes', 'seconds']
|
||||||
|
|
||||||
const parsed = items.filter(x => required.includes(x)).map(m => data[m] > 0 ? data[m] : '')
|
const parsed = items.filter(x => required.includes(x)).map(m => data[m] > 0 ? data[m] : '')
|
||||||
const final = parsed.filter(x => !!x).join(':')
|
const final = parsed.filter(x => !!x).map((x) => x.toString().padStart(2, '0')).join(':')
|
||||||
return final.length <= 3 ? `0:${final.length === 1 ? `0${final}` : final || 0}` : final
|
return final.length <= 3 ? `0:${final.padStart(2, '0') || 0}` : final
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue