mirror of
https://git.sr.ht/~cadence/cloudtube
synced 2026-03-02 02:31:35 +00:00
Rebuild second__lengthText if needed
This commit is contained in:
parent
d5d02bcef9
commit
5c3a4df209
2 changed files with 16 additions and 0 deletions
|
|
@ -18,4 +18,14 @@ function timeToPastText(timestamp) {
|
|||
}, null) || "just now"
|
||||
}
|
||||
|
||||
function lengthSecondsToLengthText(seconds) {
|
||||
return [Math.floor(seconds/3600), Math.floor(seconds/60)%60, seconds%60]
|
||||
.reduce((a, c, i, t) => (
|
||||
a ? a : c || i == 1 ? t.slice(i) : false
|
||||
), false)
|
||||
.map((x, i) => i === 0 ? x : (x+"").padStart(2, "0"))
|
||||
.join(":")
|
||||
}
|
||||
|
||||
module.exports.timeToPastText = timeToPastText
|
||||
module.exports.lengthSecondsToLengthText = lengthSecondsToLengthText
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue