mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Backport pull request #6265 from jellyfin-web/release-10.10.z
Add support for plugin revisions with bad timestamps
Original-merge: 71ab6fea5d
Merged-by: thornbill <thornbill@users.noreply.github.com>
Backported-by: Joshua M. Boniface <joshua@boniface.me>
This commit is contained in:
parent
4f17bfb5ed
commit
0ff58e81b0
2 changed files with 19 additions and 3 deletions
|
@ -9,7 +9,7 @@ import Stack from '@mui/material/Stack/Stack';
|
||||||
import React, { type FC } from 'react';
|
import React, { type FC } from 'react';
|
||||||
|
|
||||||
import MarkdownBox from 'components/MarkdownBox';
|
import MarkdownBox from 'components/MarkdownBox';
|
||||||
import { parseISO8601Date, toLocaleString } from 'scripts/datetime';
|
import { getDisplayDateTime } from 'scripts/datetime';
|
||||||
import globalize from 'lib/globalize';
|
import globalize from 'lib/globalize';
|
||||||
|
|
||||||
import type { PluginDetails } from '../types/PluginDetails';
|
import type { PluginDetails } from '../types/PluginDetails';
|
||||||
|
@ -32,7 +32,7 @@ const PluginRevisions: FC<PluginRevisionsProps> = ({
|
||||||
{version.version}
|
{version.version}
|
||||||
{version.timestamp && (<>
|
{version.timestamp && (<>
|
||||||
—
|
—
|
||||||
{toLocaleString(parseISO8601Date(version.timestamp))}
|
{getDisplayDateTime(version.timestamp)}
|
||||||
</>)}
|
</>)}
|
||||||
</AccordionSummary>
|
</AccordionSummary>
|
||||||
<AccordionDetails>
|
<AccordionDetails>
|
||||||
|
|
|
@ -203,12 +203,28 @@ export function toLocaleTimeString(date, options) {
|
||||||
return date.toLocaleTimeString();
|
return date.toLocaleTimeString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getDisplayDateTime(date) {
|
||||||
|
if (!date) {
|
||||||
|
throw new Error('date cannot be null');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof date === 'string') {
|
||||||
|
try {
|
||||||
|
date = parseISO8601Date(date, true);
|
||||||
|
} catch (err) {
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return toLocaleString(date);
|
||||||
|
}
|
||||||
|
|
||||||
export function getDisplayTime(date) {
|
export function getDisplayTime(date) {
|
||||||
if (!date) {
|
if (!date) {
|
||||||
throw new Error('date cannot be null');
|
throw new Error('date cannot be null');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((typeof date).toString().toLowerCase() === 'string') {
|
if (typeof date === 'string') {
|
||||||
try {
|
try {
|
||||||
date = parseISO8601Date(date, true);
|
date = parseISO8601Date(date, true);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue