Skip to content

Instantly share code, notes, and snippets.

@kevinvalk
Created June 12, 2020 16:03
Show Gist options
  • Save kevinvalk/02a4f78abe7a9705b3404f0992b55df8 to your computer and use it in GitHub Desktop.
Save kevinvalk/02a4f78abe7a9705b3404f0992b55df8 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment