Skip to content

Commit

Permalink
Use time RFC3339
Browse files Browse the repository at this point in the history
  • Loading branch information
tknie committed Oct 17, 2024
1 parent 52ba096 commit f6e63dc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions server/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ func convertTypeToRaw(d api.ResponseRecordsItem, s string, r interface{}) {
raw := jx.Raw([]byte("\"" + str + "\""))
d[s] = raw
case *time.Time:
d[s] = jx.Raw([]byte("\"" + (*t).String() + "\""))
d[s] = jx.Raw([]byte("\"" + (*t).UTC().Format(time.RFC3339) + "\""))
case time.Time:
d[s] = jx.Raw([]byte("\"" + (t).String() + "\""))
d[s] = jx.Raw([]byte("\"" + (t).UTC().Format(time.RFC3339) + "\""))
case pgtype.Numeric:
v := uint64(t.Int.Uint64()) * uint64(math.Pow10(int(t.Exp)))
st := fmt.Sprintf("%d", v)
Expand Down
3 changes: 1 addition & 2 deletions server/store_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ func parseJx(v jx.Raw) (any, error) {
if err != nil {
return nil, err
}
layout := "2006-01-02 15:04:05 -0700 MST"
t, err := time.Parse(layout, x)
t, err := time.Parse(time.RFC3339, x)
if err == nil {
return t, err
}
Expand Down

0 comments on commit f6e63dc

Please sign in to comment.