Skip to content

Commit

Permalink
[json-decoder] Use "Local" location for field timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
daobadat7121995 committed Dec 8, 2020
1 parent 2a7a1e2 commit 0aab02f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions json/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ func (Encoder) Decode(rawData []byte) (eh.Event, context.Context, error) {
return nil, nil, errors.Wrap(err, string(rawData)+" could not unmarshal event")
}

// Use "Local" location
zone, err := time.LoadLocation("Local")
if err != nil {
return nil, nil, errors.Wrap(err, string(rawData)+" could not load location")
}
e.Timestamp = e.Timestamp.In(zone)

// Create an event of the correct type.
if data, err := eh.CreateEventData(e.EventType); err == nil {
if data != nil {
Expand Down

0 comments on commit 0aab02f

Please sign in to comment.