From ba7b006a70dd6f6c49fcdbc0feeddfdedc62aac3 Mon Sep 17 00:00:00 2001 From: andig Date: Thu, 24 Oct 2024 18:02:55 +0200 Subject: [PATCH] Api: assume local timezone if omitted (#16835) --- server/http_loadpoint_handler.go | 4 ++-- server/http_vehicle_handler.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/server/http_loadpoint_handler.go b/server/http_loadpoint_handler.go index d7ec80a67..a4cb27fb4 100644 --- a/server/http_loadpoint_handler.go +++ b/server/http_loadpoint_handler.go @@ -74,7 +74,7 @@ func planPreviewHandler(lp loadpoint.API) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) - planTime, err := time.Parse(time.RFC3339, vars["time"]) + planTime, err := time.ParseInLocation(time.RFC3339, vars["time"], nil) if err != nil { jsonError(w, http.StatusBadRequest, err) return @@ -131,7 +131,7 @@ func planEnergyHandler(lp loadpoint.API) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) - ts, err := time.Parse(time.RFC3339, vars["time"]) + ts, err := time.ParseInLocation(time.RFC3339, vars["time"], nil) if err != nil { jsonError(w, http.StatusBadRequest, err) return diff --git a/server/http_vehicle_handler.go b/server/http_vehicle_handler.go index 2682653db..ace17293d 100644 --- a/server/http_vehicle_handler.go +++ b/server/http_vehicle_handler.go @@ -78,7 +78,7 @@ func planSocHandler(site site.API) http.HandlerFunc { return } - ts, err := time.Parse(time.RFC3339, vars["time"]) + ts, err := time.ParseInLocation(time.RFC3339, vars["time"], nil) if err != nil { jsonError(w, http.StatusBadRequest, err) return