Api: assume local timezone if omitted (#16835)

This commit is contained in:
andig 2024-10-24 18:02:55 +02:00 • committed by GitHub
parent 69de8a7e69
commit ba7b006a70
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View file

@ -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