ffplayout/plugins/filters.js
2020-09-10 16:29:19 +02:00

21 lines
489 B
JavaScript

import Vue from 'vue'
Vue.filter('toMin', function (sec) {
if (sec) {
const minutes = Math.floor(sec / 60)
const seconds = Math.round(sec - minutes * 60)
return `${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')} min`
} else {
return ''
}
})
Vue.filter('filename', function (path) {
if (path) {
const pathArr = path.split('/')
return pathArr[pathArr.length - 1]
} else {
return ''
}
})