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'); }