header clock falls back to the default timezone instead of utc

This commit is contained in:
jarek committed 2026-07-31 10:10:56 +02:00
1 parent 2532c69d4a
commit 766a206055
1 file changed
+7 -2
+7 -2
View File
@@ -9,7 +9,7 @@
import { toast } from 'svelte-sonner';
import { themeStore, type FontSize } from '$lib/stores/theme';
import { formatBytes } from '$lib/utils/format';
import { getTimeFormat } from '$lib/stores/settings';
import { getTimeFormat, getDefaultTimezone } from '$lib/stores/settings';
// Font size scaling for header
let fontSize = $state<FontSize>('normal');
@@ -332,8 +332,13 @@
hostInfo ? ((hostInfo.totalMemory - hostInfo.freeMemory) / hostInfo.totalMemory) * 100 : 0
);
// Prefer the environment's own timezone; fall back to the GLOBAL default-timezone
// setting (not a hard-coded UTC). An env only STORES a timezone when it differs from
// the global default (EnvironmentModal: "save if not default"), so a plain env has no
// stored timezone and must inherit the user's chosen default here, not show UTC (#1340).
let currentTimezone = $derived(
$environments.find((e: Environment) => Number(e.id) === Number(currentEnvId))?.timezone ?? 'UTC'
$environments.find((e: Environment) => Number(e.id) === Number(currentEnvId))?.timezone
|| getDefaultTimezone()
);
function formatLastUpdated(date: Date, timezone: string): string {