Make sure we don't get durations with decimals

This commit is contained in:
Deluan 2020-11-05 18:27:46 -05:00 committed by Joe Stump
parent 1571f1b804
commit 29982bc687
No known key found for this signature in database
GPG Key ID: 29151C3EC48A0EB9

View File

@ -15,7 +15,8 @@ const format = (d) => {
const minutes = Math.floor(d / 60) % 60
const seconds = d % 60
return [hours, minutes, seconds]
.map((v) => (v < 10 ? '0' + v : v))
.map((v) => Math.round(v).toString())
.map((v) => (v.length !== 2 ? '0' + v : v))
.filter((v, i) => v !== '00' || i > 0)
.join(':')
}