replace filters with methods

This commit is contained in:
Thomas Amland
2020-09-01 20:12:14 +02:00
parent 0b7d731ed4
commit ec481171a6
5 changed files with 12 additions and 17 deletions
+9
View File
@@ -21,3 +21,12 @@ Object.keys(components).forEach((_key) => {
const key = _key as keyof typeof components
Vue.component(key, components[key])
})
Vue.prototype.$formatDuration = (value: number) => {
if (!isFinite(value)) {
return '∞'
}
const minutes = Math.floor(value / 60)
const seconds = Math.floor(value % 60)
return (minutes < 10 ? '0' : '') + minutes + ':' + (seconds < 10 ? '0' : '') + seconds
}