From cd4e3e6bcc0f23c793636aabd83af8b31363b8e2 Mon Sep 17 00:00:00 2001 From: Hosteroid Date: Mon, 2 Mar 2026 12:09:02 +0200 Subject: [PATCH] Set timezone when app is installed regardless of path Remove the installer-path exclusion when initializing the application timezone. If the installed flag file exists, the app timezone is now applied (from settings) even on installer/update routes so notifications created during upgrades use the correct timezone. UTC remains the fallback when settings or the database are unavailable, and UTC is used when the app is not installed. --- public/index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/index.php b/public/index.php index 26b639b..d1002a8 100644 --- a/public/index.php +++ b/public/index.php @@ -95,17 +95,17 @@ if (!isset($_SESSION['user_id']) && isset($_COOKIE['remember_token']) && !$isIns } // Set application timezone early (before any date operations) -if (!$isInstallerPath && file_exists($installedFlagFile)) { +// Also apply on installer paths (e.g. /install/update) when the app is already installed, +// so that notifications created during upgrades use the correct timezone. +if (file_exists($installedFlagFile)) { try { $settingModel = new \App\Models\Setting(); $timezone = $settingModel->getValue('app_timezone', 'UTC'); date_default_timezone_set($timezone); } catch (\Exception $e) { - // Database not available, use UTC as fallback date_default_timezone_set('UTC'); } } else { - // Default to UTC during installation date_default_timezone_set('UTC'); }