diff --git a/client/components/cards/LazyBookCard.vue b/client/components/cards/LazyBookCard.vue index 34b0be60..45d49ac7 100644 --- a/client/components/cards/LazyBookCard.vue +++ b/client/components/cards/LazyBookCard.vue @@ -144,6 +144,9 @@ export default { } }, computed: { + dateFormat() { + return this.store.state.serverSettings.dateFormat + }, showExperimentalFeatures() { return this.store.state.showExperimentalFeatures }, @@ -259,9 +262,9 @@ export default { return this.author }, displaySortLine() { - if (this.orderBy === 'mtimeMs') return 'Modified ' + this.$formatDate(this._libraryItem.mtimeMs) - if (this.orderBy === 'birthtimeMs') return 'Born ' + this.$formatDate(this._libraryItem.birthtimeMs) - if (this.orderBy === 'addedAt') return 'Added ' + this.$formatDate(this._libraryItem.addedAt) + if (this.orderBy === 'mtimeMs') return 'Modified ' + this.$formatDate(this._libraryItem.mtimeMs, this.dateFormat) + if (this.orderBy === 'birthtimeMs') return 'Born ' + this.$formatDate(this._libraryItem.birthtimeMs, this.dateFormat) + if (this.orderBy === 'addedAt') return 'Added ' + this.$formatDate(this._libraryItem.addedAt, this.dateFormat) if (this.orderBy === 'media.duration') return 'Duration: ' + this.$elapsedPrettyExtended(this.media.duration, false) if (this.orderBy === 'size') return 'Size: ' + this.$bytesPretty(this._libraryItem.size) if (this.orderBy === 'media.numTracks') return `${this.numEpisodes} Episodes` diff --git a/client/pages/config/index.vue b/client/pages/config/index.vue index 3dda0a60..f7a5d89c 100644 --- a/client/pages/config/index.vue +++ b/client/pages/config/index.vue @@ -4,7 +4,7 @@
-

Settings

+

Settings

@@ -27,26 +27,6 @@
-
- - -

- Use square book covers - info_outlined -

-
-
- -
- - -

- Use alternative bookshelf view - info_outlined -

-
-
-
@@ -66,7 +46,36 @@
-

Scanner Settings

+

Display Settings

+
+ +
+ + +

+ Use square book covers + info_outlined +

+
+
+ +
+ + +

+ Use alternative bookshelf view + info_outlined +

+
+
+ +
+

Date Format

+ +
+ +
+

Scanner Settings

@@ -144,7 +153,7 @@
-

Experimental Feature Settings

+

Experimental Feature Settings

@@ -282,12 +291,12 @@ export default { set(val) { this.$store.commit('setExperimentalFeatures', val) } + }, + dateFormats() { + return this.$store.state.globals.dateFormats } }, methods: { - updateEnableChromecast(val) { - this.updateServerSettings({ enableChromecast: val }) - }, updateSortingPrefixes(val) { if (!val || !val.length) { this.$toast.error('Must have at least 1 prefix') @@ -325,10 +334,12 @@ export default { .then((success) => { console.log('Updated Server Settings', success) this.updatingServerSettings = false + this.$toast.success('Server settings updated') }) .catch((error) => { console.error('Failed to update server settings', error) this.updatingServerSettings = false + this.$toast.error('Failed to update server settings') }) }, initServerSettings() { diff --git a/client/pages/item/_id/index.vue b/client/pages/item/_id/index.vue index 8128b798..e0be6dad 100644 --- a/client/pages/item/_id/index.vue +++ b/client/pages/item/_id/index.vue @@ -118,9 +118,9 @@

Your Progress: {{ Math.round(progressPercent * 100) }}%

-

Finished {{ $formatDate(userProgressFinishedAt, 'MM/dd/yyyy') }}

+

Finished {{ $formatDate(userProgressFinishedAt, dateFormat) }}

{{ $elapsedPretty(userTimeRemaining) }} remaining

-

Started {{ $formatDate(userProgressStartedAt, 'MM/dd/yyyy') }}

+

Started {{ $formatDate(userProgressStartedAt, dateFormat) }}

close @@ -226,6 +226,9 @@ export default { } }, computed: { + dateFormat() { + return this.$store.state.serverSettings.dateFormat + }, showExperimentalFeatures() { return this.$store.state.showExperimentalFeatures }, diff --git a/client/plugins/init.client.js b/client/plugins/init.client.js index bdc1b2f5..4e39ef51 100644 --- a/client/plugins/init.client.js +++ b/client/plugins/init.client.js @@ -169,7 +169,7 @@ Vue.prototype.$sanitizeSlug = (str) => { str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i)) } - str = str.replace('.', '-') // replace a dot by a dash + str = str.replace('.', '-') // replace a dot by a dash .replace(/[^a-z0-9 -_]/g, '') // remove invalid chars .replace(/\s+/g, '-') // collapse whitespace and replace by a dash .replace(/-+/g, '-') // collapse dashes diff --git a/client/store/globals.js b/client/store/globals.js index b02eb286..f1bb51f4 100644 --- a/client/store/globals.js +++ b/client/store/globals.js @@ -1,4 +1,3 @@ - export const state = () => ({ isMobile: false, isMobileLandscape: false, @@ -12,7 +11,21 @@ export const state = () => ({ selectedCollection: null, selectedAuthor: null, isCasting: false, // Actively casting - isChromecastInitialized: false // Script loaded + isChromecastInitialized: false, // Script loaded + dateFormats: [ + { + text: 'MM/DD/YYYY', + value: 'MM/dd/yyyy' + }, + { + text: 'DD/MM/YYYY', + value: 'dd/MM/yyyy' + }, + { + text: 'YYYY-MM-DD', + value: 'yyyy-MM-dd' + } + ] }) export const getters = { diff --git a/client/tailwind.config.js b/client/tailwind.config.js index b6e831fc..4e5784b7 100644 --- a/client/tailwind.config.js +++ b/client/tailwind.config.js @@ -31,6 +31,7 @@ module.exports = { '20': '5rem', '24': '6rem', '32': '8rem', + '40': '10rem', '48': '12rem', '64': '16rem', '80': '20rem' diff --git a/server/objects/settings/ServerSettings.js b/server/objects/settings/ServerSettings.js index 00c56b2a..84ee80d8 100644 --- a/server/objects/settings/ServerSettings.js +++ b/server/objects/settings/ServerSettings.js @@ -12,7 +12,7 @@ class ServerSettings { this.scannerPreferAudioMetadata = false this.scannerPreferOpfMetadata = false this.scannerPreferMatchedMetadata = false - this.scannerDisableWatcher = false + this.scannerDisableWatcher = false this.scannerPreferOverdriveMediaMarker = false // Metadata - choose to store inside users library item folder @@ -48,6 +48,7 @@ class ServerSettings { // Misc Flags this.chromecastEnabled = false this.enableEReader = false + this.dateFormat = 'MM/dd/yyyy' this.logLevel = Logger.logLevel @@ -95,6 +96,7 @@ class ServerSettings { this.sortingPrefixes = settings.sortingPrefixes || ['the', 'a'] this.chromecastEnabled = !!settings.chromecastEnabled this.enableEReader = !!settings.enableEReader + this.dateFormat = settings.dateFormat || 'MM/dd/yyyy' this.logLevel = settings.logLevel || Logger.logLevel this.version = settings.version || null @@ -130,6 +132,7 @@ class ServerSettings { sortingPrefixes: [...this.sortingPrefixes], chromecastEnabled: this.chromecastEnabled, enableEReader: this.enableEReader, + dateFormat: this.dateFormat, logLevel: this.logLevel, version: this.version }