mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-06-23 17:29:19 +02:00
Add: Listening statistics and chart on stats page #167
This commit is contained in:
parent
416aa3bd60
commit
02da95377e
7 changed files with 357 additions and 51 deletions
|
@ -1,6 +1,6 @@
|
|||
import Vue from 'vue'
|
||||
import vClickOutside from 'v-click-outside'
|
||||
import { formatDistance, format } from 'date-fns'
|
||||
import { formatDistance, format, addDays, isDate } from 'date-fns'
|
||||
|
||||
Vue.directive('click-outside', vClickOutside.directive)
|
||||
|
||||
|
@ -16,6 +16,15 @@ Vue.prototype.$formatDate = (unixms, fnsFormat = 'MM/dd/yyyy HH:mm') => {
|
|||
if (!unixms) return ''
|
||||
return format(unixms, fnsFormat)
|
||||
}
|
||||
Vue.prototype.$formatJsDate = (jsdate, fnsFormat = 'MM/dd/yyyy HH:mm') => {
|
||||
if (!jsdate || !isDate(jsdate)) return ''
|
||||
return format(jsdate, fnsFormat)
|
||||
}
|
||||
Vue.prototype.$addDaysToToday = (daysToAdd) => {
|
||||
var date = addDays(new Date(), daysToAdd)
|
||||
if (!date || !isDate(date)) return null
|
||||
return date
|
||||
}
|
||||
|
||||
Vue.prototype.$bytesPretty = (bytes, decimals = 2) => {
|
||||
if (bytes === 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue