feat(webui): display read date on book details view

Closes: #757
This commit is contained in:
Gauthier Roebroeck 2023-01-17 15:11:51 +08:00
parent 77424b1b1c
commit c30c755f63
2 changed files with 14 additions and 0 deletions

View file

@ -225,6 +225,7 @@
"pending_tasks": "No pending tasks | 1 pending task | {count} pending tasks",
"publisher": "Publisher",
"read": "Read",
"read_on": "Read on {date}",
"readlists": "Read Lists",
"required": "Required",
"reset_filters": "Reset filters",

View file

@ -117,6 +117,11 @@
>
{{ $tc('common.pages_left', pagesLeft) }}
</div>
<div v-else-if="isRead"
class="text-caption text-center mt-1"
>
{{ $t('common.read_on', {date: readProgressDate}) }}
</div>
</v-col>
<v-col cols="8">
@ -516,6 +521,14 @@ export default Vue.extend({
readProgressPercentage(): number {
return getReadProgressPercentage(this.book)
},
readProgressDate(): string | undefined {
if (this.book.readProgress)
return new Intl.DateTimeFormat(this.$i18n.locale, {
dateStyle: 'medium',
timeStyle: 'short',
} as Intl.DateTimeFormatOptions).format(new Date(this.book.readProgress.lastModified))
return undefined
},
previousId(): string {
return this.siblingPrevious?.id?.toString() || '0'
},