fix(web): Make date-time formatting follow locale (#17899)

* fixed missing $locale parameter to .toLocaleString

* Remove unused types and functions in timeline-util

* remove unused export

* re-enable export because it is needed for tests

* format
This commit is contained in:
Andreas Tollkötter
2025-04-28 15:53:26 +02:00
committed by GitHub
parent 205260d31c
commit 85ac0512a6
6 changed files with 31 additions and 70 deletions

View File

@@ -1,6 +1,7 @@
import { locale } from '$lib/stores/preferences.store';
import { AssetTypeEnum, type AssetResponseDto } from '@immich/sdk';
import { t } from 'svelte-i18n';
import { derived } from 'svelte/store';
import { derived, get } from 'svelte/store';
import { fromLocalDateTime } from './timeline-util';
/**
@@ -43,7 +44,7 @@ export const getAltText = derived(t, ($t) => {
return asset.exifInfo.description;
}
const date = fromLocalDateTime(asset.localDateTime).toLocaleString({ dateStyle: 'long' });
const date = fromLocalDateTime(asset.localDateTime).toLocaleString({ dateStyle: 'long' }, { locale: get(locale) });
const hasPlace = !!asset.exifInfo?.city && !!asset.exifInfo?.country;
const names = asset.people?.filter((p) => p.name).map((p) => p.name) ?? [];
const peopleCount = names.length;