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
This commit is contained in:
marco370 2025-10-21 17:06:41 +00:00
parent 10b543ebab
commit c2c35b62b5

View File

@ -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)