mirror of
https://github.com/gotson/komga.git
synced 2026-04-18 21:13:24 +02:00
fix(webui): display release date without timezone adjustment
closes #818
This commit is contained in:
parent
8272cbe52a
commit
d343740f30
2 changed files with 7 additions and 4 deletions
|
|
@ -104,7 +104,7 @@ export class BookItem extends Item<BookDto> {
|
||||||
default:
|
default:
|
||||||
let text
|
let text
|
||||||
if (context.includes(ItemContext.RELEASE_DATE))
|
if (context.includes(ItemContext.RELEASE_DATE))
|
||||||
text = this.item.metadata.releaseDate ? new Intl.DateTimeFormat(i18n.locale, {dateStyle: 'medium'} as Intl.DateTimeFormatOptions).format(new Date(this.item.metadata.releaseDate)) : i18n.t('book_card.no_release_date')
|
text = this.item.metadata.releaseDate ? new Intl.DateTimeFormat(i18n.locale, {dateStyle: 'medium', timeZone: 'UTC'} as Intl.DateTimeFormatOptions).format(new Date(this.item.metadata.releaseDate)) : i18n.t('book_card.no_release_date')
|
||||||
else if (context.includes(ItemContext.DATE_ADDED))
|
else if (context.includes(ItemContext.DATE_ADDED))
|
||||||
text = new Intl.DateTimeFormat(i18n.locale, {dateStyle: 'medium'} as Intl.DateTimeFormatOptions).format(new Date(this.item.created))
|
text = new Intl.DateTimeFormat(i18n.locale, {dateStyle: 'medium'} as Intl.DateTimeFormatOptions).format(new Date(this.item.created))
|
||||||
else if (context.includes(ItemContext.READ_DATE))
|
else if (context.includes(ItemContext.READ_DATE))
|
||||||
|
|
@ -162,7 +162,7 @@ export class SeriesItem extends Item<SeriesDto> {
|
||||||
|
|
||||||
let text
|
let text
|
||||||
if (context.includes(ItemContext.RELEASE_DATE))
|
if (context.includes(ItemContext.RELEASE_DATE))
|
||||||
text = this.item.booksMetadata.releaseDate ? new Intl.DateTimeFormat(i18n.locale, {dateStyle: 'medium'} as Intl.DateTimeFormatOptions).format(new Date(this.item.booksMetadata.releaseDate)) : i18n.t('book_card.no_release_date')
|
text = this.item.booksMetadata.releaseDate ? new Intl.DateTimeFormat(i18n.locale, {dateStyle: 'medium', timeZone: 'UTC'} as Intl.DateTimeFormatOptions).format(new Date(this.item.booksMetadata.releaseDate)) : i18n.t('book_card.no_release_date')
|
||||||
else if (context.includes(ItemContext.DATE_ADDED))
|
else if (context.includes(ItemContext.DATE_ADDED))
|
||||||
text = new Intl.DateTimeFormat(i18n.locale, {dateStyle: 'medium'} as Intl.DateTimeFormatOptions).format(new Date(this.item.created))
|
text = new Intl.DateTimeFormat(i18n.locale, {dateStyle: 'medium'} as Intl.DateTimeFormatOptions).format(new Date(this.item.created))
|
||||||
else if (context.includes(ItemContext.DATE_UPDATED))
|
else if (context.includes(ItemContext.DATE_UPDATED))
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,9 @@
|
||||||
:to="{ name: 'browse-book', params: { bookId: book.id }, query: { context: context.origin, contextId: context.id} }"
|
:to="{ name: 'browse-book', params: { bookId: book.id }, query: { context: context.origin, contextId: context.id} }"
|
||||||
>
|
>
|
||||||
<v-list-item-title class="text-wrap text-body-2">
|
<v-list-item-title class="text-wrap text-body-2">
|
||||||
<template v-if="contextReadList">{{ book.seriesTitle }} {{ book.metadata.number }}: {{ book.metadata.title }}</template>
|
<template v-if="contextReadList">{{ book.seriesTitle }} {{ book.metadata.number }}:
|
||||||
|
{{ book.metadata.title }}
|
||||||
|
</template>
|
||||||
<template v-else>{{ book.metadata.number }} - {{ book.metadata.title }}</template>
|
<template v-else>{{ book.metadata.number }} - {{ book.metadata.title }}</template>
|
||||||
</v-list-item-title>
|
</v-list-item-title>
|
||||||
</v-list-item>
|
</v-list-item>
|
||||||
|
|
@ -146,7 +148,7 @@
|
||||||
|
|
||||||
<v-col cols="auto" v-if="book.metadata.releaseDate">
|
<v-col cols="auto" v-if="book.metadata.releaseDate">
|
||||||
{{
|
{{
|
||||||
new Intl.DateTimeFormat($i18n.locale, {dateStyle: 'long'}).format(new Date(book.metadata.releaseDate))
|
new Intl.DateTimeFormat($i18n.locale, {dateStyle: 'long', timeZone: 'UTC'}).format(new Date(book.metadata.releaseDate))
|
||||||
}}
|
}}
|
||||||
</v-col>
|
</v-col>
|
||||||
|
|
||||||
|
|
@ -418,6 +420,7 @@ import {convertErrorCodes} from '@/functions/error-codes'
|
||||||
import RtlIcon from '@/components/RtlIcon.vue'
|
import RtlIcon from '@/components/RtlIcon.vue'
|
||||||
import {BookSseDto, LibrarySseDto, ReadListSseDto, ReadProgressSseDto} from '@/types/komga-sse'
|
import {BookSseDto, LibrarySseDto, ReadListSseDto, ReadProgressSseDto} from '@/types/komga-sse'
|
||||||
import {RawLocation} from 'vue-router/types/router'
|
import {RawLocation} from 'vue-router/types/router'
|
||||||
|
import {zonedTimeToUtc} from 'date-fns-tz'
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
name: 'BrowseBook',
|
name: 'BrowseBook',
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue