1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Add date filter to activity table

This commit is contained in:
Bill Thornton 2024-08-29 01:59:33 -04:00
parent aaa116d218
commit 07bb315bb3
5 changed files with 105 additions and 48 deletions

View file

@ -67,11 +67,21 @@ const DEFAULT_LOCALE = 'en-US';
let localeString = DEFAULT_LOCALE;
let locale = enUS;
export function fetchLocale(localeName: string) {
return import(`date-fns/locale/${localeName}/index.js`);
}
export function normalizeLocale(localeName: string) {
return LOCALE_MAP[localeName]
|| LOCALE_MAP[localeName.replace(/-.*/, '')]
|| DEFAULT_LOCALE;
}
export async function updateLocale(newLocale: string) {
console.debug('[dateFnsLocale] updating date-fns locale', newLocale);
localeString = LOCALE_MAP[newLocale] || LOCALE_MAP[newLocale.replace(/-.*/, '')] || DEFAULT_LOCALE;
localeString = normalizeLocale(newLocale);
console.debug('[dateFnsLocale] mapped to date-fns locale', localeString);
locale = await import(`date-fns/locale/${localeString}/index.js`);
locale = await fetchLocale(localeString);
}
export function getLocale() {