From ac08c67332b044536bcd0ef8a0765dec150e5342 Mon Sep 17 00:00:00 2001 From: Jaronim Pracht Date: Thu, 26 Jun 2025 22:26:45 +0200 Subject: [PATCH] Adjust time zone offset for date formatting Add 2 hours to the hour component to account for the time zone difference in the application context --- project/frontend/src/util/date.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/project/frontend/src/util/date.ts b/project/frontend/src/util/date.ts index 13dbfa8..763e47c 100644 --- a/project/frontend/src/util/date.ts +++ b/project/frontend/src/util/date.ts @@ -1,11 +1,11 @@ export const formatDate = (dateString: string): string => { - const date = new Date(dateString); + const date = new Date(dateString); - const hours = String(date.getHours()).padStart(2, '0'); - const minutes = String(date.getMinutes()).padStart(2, '0'); - const month = String(date.getMonth() + 1).padStart(2, '0'); // Months are zero-based - const day = String(date.getDate()).padStart(2, '0'); - const year = date.getFullYear(); + const hours = String(date.getHours() + 2).padStart(2, "0"); + const minutes = String(date.getMinutes()).padStart(2, "0"); + const month = String(date.getMonth() + 1).padStart(2, "0"); // Months are zero-based + const day = String(date.getDate()).padStart(2, "0"); + const year = date.getFullYear(); - return `${hours}:${minutes} ${day}.${month}.${year}`; + return `${hours}:${minutes} ${day}.${month}.${year}`; }; -- 2.43.0