Adjust time zone offset for date formatting
Add 2 hours to the hour component to account for the time zone difference in the application contextpull/108/head
parent
23f047df4e
commit
ac08c67332
|
|
@ -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}`;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue