From 229755bf5691f2100849cc40b147ece329d522c9 Mon Sep 17 00:00:00 2001 From: Valiante <13119903+Valiante@users.noreply.github.com> Date: Wed, 12 Aug 2026 15:35:23 +0100 Subject: [PATCH] Fix: clock shows wrong timezone after header reload (#1640) tz/LOCALE were evaluated once as module-level consts at script-load time. clearCache() (the header reload button) wipes localStorage right before reloading, so that reload could read an empty settings cache, fall back to the hardcoded 'Europe/Berlin' default, and stay locked to that wrong value for the rest of the page's life. Moved the reads inside localizeTimestamp() so they're evaluated fresh on every call instead. --- front/js/common.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/front/js/common.js b/front/js/common.js index eb351397..9538a04b 100755 --- a/front/js/common.js +++ b/front/js/common.js @@ -88,14 +88,16 @@ function deleteCookie (cookie) { // ----------------------------------------------------------------------------- // cacheStrings, getString, getLangCode moved to cache.js - const tz = getSetting("TIMEZONE") || 'Europe/Berlin'; - const LOCALE = getSetting('UI_LOCALE') || 'en-GB'; - // ----------------------------------------------------------------------------- // DateTime utilities // ----------------------------------------------------------------------------- function localizeTimestamp(input) { + // Read fresh on every call (not a module-level const): getSetting() reads + // a localStorage cache that clearCache() wipes before reloading, so a + // stale/hardcoded fallback could otherwise stick for the page's lifetime. See #1640. + const tz = getSetting("TIMEZONE") || 'Europe/Berlin'; + const LOCALE = getSetting('UI_LOCALE') || 'en-GB'; input = String(input || '').trim();