Skip to content

Commit

Permalink
Api: assume local timezone if omitted (#16835)
Browse files Browse the repository at this point in the history
  • Loading branch information
andig authored Oct 24, 2024
1 parent 69de8a7 commit ba7b006
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions server/http_loadpoint_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion server/http_vehicle_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ba7b006

Please sign in to comment.