Use "Intl.DateTimeFormat" instead of Date locale functions
It's recommended to use "Intl.DateTimeFormat" instead of using Date locale functions which get called often with the same options (e.g. https://developer.mozilla.org/en-US/docs/web/javascript/reference/global_objects/date/tolocaletimestring)
This commit is contained in:
@@ -16,6 +16,7 @@ import { makeToast } from '@/components/util/Toast';
|
||||
import { UpdaterSubscription } from '@/lib/graphql/generated/graphql.ts';
|
||||
import { Progress } from '@/components/util/Progress';
|
||||
import { defaultPromiseErrorHandler } from '@/util/defaultPromiseErrorHandler.ts';
|
||||
import { dateTimeFormatter } from '@/util/date.ts';
|
||||
|
||||
const calcProgress = (status: UpdaterSubscription['updateStatusChanged'] | undefined) => {
|
||||
if (!status) {
|
||||
@@ -82,7 +83,7 @@ export function UpdateChecker({ handleFinishedUpdate }: { handleFinishedUpdate?:
|
||||
return (
|
||||
<Tooltip
|
||||
title={t('library.settings.global_update.label.last_update_tooltip', {
|
||||
date: lastUpdateTimestamp ? new Date(+lastUpdateTimestamp).toLocaleString() : '-',
|
||||
date: lastUpdateTimestamp ? dateTimeFormatter.format(+lastUpdateTimestamp) : '-',
|
||||
})}
|
||||
>
|
||||
<IconButton onClick={onClick} disabled={loading}>
|
||||
|
||||
Reference in New Issue
Block a user