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
pull/108/head
Jaronim Pracht 2025-06-26 22:26:45 +02:00
parent 23f047df4e
commit ac08c67332
1 changed files with 7 additions and 7 deletions

View File

@ -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}`;
};