Skip to content
This repository has been archived by the owner on Mar 24, 2023. It is now read-only.

Commit

Permalink
Parse node 10 time format
Browse files Browse the repository at this point in the history
  • Loading branch information
divolgin committed Jun 11, 2020
1 parent 076cab9 commit 51480bf
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions pkg/specs/replicatedapp/graphql.go
Expand Up @@ -8,6 +8,7 @@ import (
"io/ioutil"
"net/http"
"net/url"
"strings"
"time"

multierror "github.com/hashicorp/go-multierror"
Expand Down Expand Up @@ -167,8 +168,24 @@ type GQLRegisterInstallResponse struct {
}

func parseServerTS(ts string) time.Time {
parsed, _ := time.Parse("Mon Jan 02 2006 15:04:05 GMT-0700 (MST)", ts)
return parsed
parsed, err := time.Parse(time.RFC3339, ts)
if err == nil {
return parsed
}

ts = strings.TrimSuffix(ts, "+0000 (UTC)")
parsed, err = time.Parse("Mon Jan 02 2006 15:04:05 MST", ts)
if err == nil {
return parsed
}

ts = strings.TrimSuffix(ts, "+0000 (Coordinated Universal Time)")
parsed, err = time.Parse("Mon Jan 02 2006 15:04:05 MST", ts)
if err == nil {
return parsed
}

return time.Time{}
}

type license struct {
Expand Down

0 comments on commit 51480bf

Please sign in to comment.