fix(web): format dates with the locale preference (#18259)

fix: Format dates in settings according to user setting
This commit is contained in:
Sebastian Schneider
2025-05-16 18:03:54 +02:00
committed by GitHub
parent 28d8357cc5
commit 1219fd82a0
3 changed files with 15 additions and 9 deletions

View File

@@ -18,6 +18,7 @@
import { fade } from 'svelte/transition';
import { handleError } from '../../utils/handle-error';
import { notificationController, NotificationType } from '../shared-components/notification/notification';
import { dateFormats } from '$lib/constants';
interface Props {
keys: ApiKeyResponseDto[];
@@ -25,12 +26,6 @@
let { keys = $bindable() }: Props = $props();
const format: Intl.DateTimeFormatOptions = {
month: 'short',
day: 'numeric',
year: 'numeric',
};
async function refreshKeys() {
keys = await getApiKeys();
}
@@ -130,7 +125,7 @@
>
<td class="w-1/3 text-ellipsis px-4 text-sm">{key.name}</td>
<td class="w-1/3 text-ellipsis px-4 text-sm"
>{new Date(key.createdAt).toLocaleDateString($locale, format)}
>{new Date(key.createdAt).toLocaleDateString($locale, dateFormats.settings)}
</td>
<td class="flex flex-row flex-wrap justify-center gap-x-2 gap-y-1 w-1/3">
<CircleIconButton