From c2c35b62b5e42975b5cc21332440b0f2d0f90df6 Mon Sep 17 00:00:00 2001 From: marco370 <48531002-marco370@users.noreply.replit.com> Date: Tue, 21 Oct 2025 17:06:41 +0000 Subject: [PATCH] Fix time display to prevent incorrect hour shifts Correct the time formatting logic in the general planning component to explicitly use UTC, resolving an issue where shifts of +2 hours were incorrectly applied due to local timezone conversions. Replit-Commit-Author: Agent Replit-Commit-Session-Id: e5565357-90e1-419f-b9a8-6ee8394636df Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/6d543d2c-20b9-4ea6-93fe-70fe9b1d9f80/e5565357-90e1-419f-b9a8-6ee8394636df/qoWuIE4 --- client/src/pages/general-planning.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/client/src/pages/general-planning.tsx b/client/src/pages/general-planning.tsx index e1b3916..5d00b2e 100644 --- a/client/src/pages/general-planning.tsx +++ b/client/src/pages/general-planning.tsx @@ -72,9 +72,15 @@ interface GeneralPlanningResponse { } // Helper per formattare orario in formato italiano 24h (HH:MM) +// IMPORTANTE: usa timeZone UTC per evitare shift di +2 ore const formatTime = (dateString: string) => { const date = new Date(dateString); - return date.toLocaleTimeString("it-IT", { hour: "2-digit", minute: "2-digit", hour12: false }); + return date.toLocaleTimeString("it-IT", { + hour: "2-digit", + minute: "2-digit", + hour12: false, + timeZone: "UTC" // Evita conversione timezone locale (+2h in Italia) + }); }; // Helper per formattare data in formato italiano (gg/mm/aaaa)