diff --git a/client/components/Search/BaseList.js b/client/components/Search/BaseList.js index 605cf72..959535f 100644 --- a/client/components/Search/BaseList.js +++ b/client/components/Search/BaseList.js @@ -50,7 +50,7 @@ export default class BaseList { expandedSeries = []; showCounts = true; - showRate = true; + showRates = true; showGenres = true; showDeleted = false; abCacheEnabled = true; @@ -81,7 +81,7 @@ export default class BaseList { this.expandedAuthor = _.cloneDeep(settings.expandedAuthor); this.expandedSeries = _.cloneDeep(settings.expandedSeries); this.showCounts = settings.showCounts; - this.showRate = settings.showRate; + this.showRates = settings.showRates; this.showGenres = settings.showGenres; this.showDeleted = settings.showDeleted; this.abCacheEnabled = settings.abCacheEnabled; diff --git a/client/components/Search/BookView/BookView.vue b/client/components/Search/BookView/BookView.vue index be013a3..59a12b9 100644 --- a/client/components/Search/BookView/BookView.vue +++ b/client/components/Search/BookView/BookView.vue @@ -1,8 +1,8 @@ diff --git a/client/share/utils.js b/client/share/utils.js index 849b2e0..c6d9d86 100644 --- a/client/share/utils.js +++ b/client/share/utils.js @@ -98,3 +98,30 @@ export function makeValidFilename(filename, repl = '_') { else throw new Error('Invalid filename'); } + +export function formatDate(d, format = 'normal') { + switch (format) { + case 'normal': + return `${d.getDate().toString().padStart(2, '0')}.${(d.getMonth() + 1).toString().padStart(2, '0')}.${d.getFullYear()} ` + + `${d.getHours().toString().padStart(2, '0')}:${d.getMinutes().toString().padStart(2, '0')}`; + case 'coDate': + return `${d.getFullYear()}-${(d.getMonth() + 1).toString().padStart(2, '0')}-${d.getDate().toString().padStart(2, '0')}`; + case 'coMonth': + return `${(d.getMonth() + 1).toString().padStart(2, '0')}`; + case 'noDate': + return `${d.getDate().toString().padStart(2, '0')}.${(d.getMonth() + 1).toString().padStart(2, '0')}.${d.getFullYear()}`; + + default: + throw new Error('formatDate: unknown date format'); + } +} + +export function parseDate(sqlDate) { + const d = sqlDate.split('-'); + const result = new Date(); + result.setDate(parseInt(d[2], 10)); + result.setMonth(parseInt(d[1], 10) - 1); + result.setYear(parseInt(d[0], 10)); + + return result; +} \ No newline at end of file diff --git a/client/store/root.js b/client/store/root.js index 8ee7ac8..eb89ec2 100644 --- a/client/store/root.js +++ b/client/store/root.js @@ -8,8 +8,9 @@ const state = { expandedAuthor: [], expandedSeries: [], showCounts: true, - showRate: true, + showRates: true, showGenres: true, + showDates: false, showDeleted: false, abCacheEnabled: true, langDefault: '',