From bbe9d82e6c245c13ad22396883de0222b1926253 Mon Sep 17 00:00:00 2001 From: Kevin Valk Date: Fri, 12 Jun 2020 20:36:21 +0200 Subject: [PATCH] Implemented workaround for issue #33 --- rest/response.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/rest/response.go b/rest/response.go index fb7cbaf..0af3b0e 100644 --- a/rest/response.go +++ b/rest/response.go @@ -43,14 +43,12 @@ type Date struct { // UnmarshalJSON parses datetime strings returned by the transip api func (tt *Time) UnmarshalJSON(input []byte) error { - loc, err := time.LoadLocation("Europe/Amsterdam") - if err != nil { - return err - } // don't parse on empty dates if string(input) == `""` { return nil } + + loc := time.FixedZone("CEST", 2*60*60) newTime, err := time.ParseInLocation(`"2006-01-02 15:04:05"`, string(input), loc) if err != nil { return err @@ -62,14 +60,12 @@ func (tt *Time) UnmarshalJSON(input []byte) error { // UnmarshalJSON parses date strings returned by the transip api func (td *Date) UnmarshalJSON(input []byte) error { - loc, err := time.LoadLocation("Europe/Amsterdam") - if err != nil { - return err - } // don't parse on empty dates if string(input) == `""` { return nil } + + loc := time.FixedZone("CEST", 2*60*60) newTime, err := time.ParseInLocation(`"2006-01-02"`, string(input), loc) if err != nil { return err