diff --git a/admin-dashboard.html b/admin-dashboard.html index 933cdb3..49c3d45 100644 --- a/admin-dashboard.html +++ b/admin-dashboard.html @@ -4306,16 +4306,23 @@ function displayReservations(reservations) { return; } - tbody.innerHTML = reservations.map(res => ` - - ${res.driverName} - ${res.vehicle} - ${formatDateTime(res.startDate, res.startTime)} - ${formatDateTime(res.endDate, res.endTime)} - ${res.purpose || '-'} - ${calculateDuration(res)} - - `).join(''); + tbody.innerHTML = reservations.map(res => { + const startDate = new Date(res.start); + const endDate = new Date(res.end); + const formattedStart = startDate.toLocaleString('cs-CZ'); + const formattedEnd = endDate.toLocaleString('cs-CZ'); + + return ` + + ${res.driverName || '-'} + ${res.vehicle || '-'} + ${formattedStart} + ${formattedEnd} + ${res.purpose || '-'} + ${calculateDuration(res)} + + `; + }).join(''); } // Function to filter reservations @@ -4391,8 +4398,8 @@ function formatDateTime(date, time) { // Helper function to calculate duration function calculateDuration(reservation) { - const start = new Date(`${reservation.startDate}T${reservation.startTime}`); - const end = new Date(`${reservation.endDate}T${reservation.endTime}`); + const start = new Date(reservation.start); + const end = new Date(reservation.end); const diff = end - start; const days = Math.floor(diff / (1000 * 60 * 60 * 24));