From e6f6e5962a81450ec8861347b9f2417779a87313 Mon Sep 17 00:00:00 2001 From: gbaranski Date: Sun, 6 Nov 2022 20:55:05 +0100 Subject: [PATCH] fix(tristar): closes #16 --- providers/tristar/gdansk/provider.go | 11 ++++++++++- providers/tristar/gdynia/provider.go | 5 +++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/providers/tristar/gdansk/provider.go b/providers/tristar/gdansk/provider.go index a536e0b..8247219 100644 --- a/providers/tristar/gdansk/provider.go +++ b/providers/tristar/gdansk/provider.go @@ -2,6 +2,7 @@ package gdansk import ( "log" + "time" wheretopark "wheretopark/go" geojson "github.com/paulmach/go.geojson" @@ -59,8 +60,16 @@ func (p Provider) GetState() (map[wheretopark.ID]wheretopark.State, error) { continue } + location, err := time.LoadLocation("Europe/Warsaw") + if err != nil { + return nil, err + } + lastUpdate, err := time.Parse(time.RFC3339, vendorState.LastUpdate) + if err != nil { + return nil, err + } state := wheretopark.State{ - LastUpdated: vendor.LastUpdate, + LastUpdated: lastUpdate.In(location).Format(time.RFC3339), AvailableSpots: map[string]uint{ "CAR": vendor.AvailableSpots, }, diff --git a/providers/tristar/gdynia/provider.go b/providers/tristar/gdynia/provider.go index b22c43c..dee7707 100644 --- a/providers/tristar/gdynia/provider.go +++ b/providers/tristar/gdynia/provider.go @@ -62,6 +62,11 @@ func (p Provider) GetState() (map[wheretopark.ID]wheretopark.State, error) { if err != nil { return nil, err } + location, err := time.LoadLocation("Europe/Warsaw") + if err != nil { + return nil, err + } + lastUpdate = lastUpdate.In(location) state := wheretopark.State{ LastUpdated: lastUpdate.Format(time.RFC3339), AvailableSpots: map[string]uint{