MMS43 changes

This commit is contained in:
Arnaud Delcasse
2025-12-29 10:50:58 +01:00
parent 52de8d363e
commit 6cda7509c1
6 changed files with 126 additions and 79 deletions

View File

@@ -178,9 +178,34 @@ func (h *Handler) VehicleManagementBookingDisplayHTTPHandler() http.HandlerFunc
// Parse form data
r.ParseForm()
// Extract date and time values
startDateStr := r.FormValue("startdate")
startTimeStr := r.FormValue("starttime")
endDateStr := r.FormValue("enddate")
endTimeStr := r.FormValue("endtime")
// Parse dates with times in Europe/Paris timezone
paris, _ := time.LoadLocation("Europe/Paris")
var startDate, endDate *time.Time
if startDateStr != "" {
if startTimeStr == "" {
startTimeStr = "00:00"
}
t, _ := time.ParseInLocation("2006-01-02 15:04", startDateStr+" "+startTimeStr, paris)
startDate = &t
}
if endDateStr != "" {
if endTimeStr == "" {
endTimeStr = "23:59"
}
t, _ := time.ParseInLocation("2006-01-02 15:04", endDateStr+" "+endTimeStr, paris)
endDate = &t
}
err := h.applicationHandler.UpdateBooking(r.Context(), bookingID,
r.FormValue("startdate"),
r.FormValue("enddate"),
startDate,
endDate,
r.FormValue("unavailablefrom"),
r.FormValue("unavailableto"),
)