mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-07-31 08:04:46 +02:00
feat: add stats page to mobile
This commit is contained in:
parent
837df329e2
commit
014588180e
4 changed files with 382 additions and 4 deletions
|
@ -2,7 +2,7 @@ import Vue from 'vue'
|
|||
import { App } from '@capacitor/app'
|
||||
import { Dialog } from '@capacitor/dialog'
|
||||
import { StatusBar, Style } from '@capacitor/status-bar';
|
||||
import { formatDistance, format } from 'date-fns'
|
||||
import { formatDistance, format, addDays, isDate } from 'date-fns'
|
||||
import { Capacitor } from '@capacitor/core';
|
||||
|
||||
Vue.prototype.$eventBus = new Vue()
|
||||
|
@ -24,7 +24,20 @@ 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.$addDaysToDate = (jsdate, daysToAdd) => {
|
||||
var date = addDays(jsdate, daysToAdd)
|
||||
if (!date || !isDate(date)) return null
|
||||
return date
|
||||
}
|
||||
Vue.prototype.$bytesPretty = (bytes, decimals = 2) => {
|
||||
if (isNaN(bytes) || bytes === null) return 'Invalid Bytes'
|
||||
if (bytes === 0) {
|
||||
|
@ -162,4 +175,4 @@ export default ({ store, app }) => {
|
|||
export {
|
||||
encode,
|
||||
decode
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue