Skip to content

Commit

Permalink
Fix JSON Marshaling for Millis and Nanos Types (#368)
Browse files Browse the repository at this point in the history
  • Loading branch information
justinpolygon authored Dec 5, 2023
1 parent 1c11536 commit 5511c91
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions rest/models/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ func (m *Millis) UnmarshalJSON(data []byte) error {
return nil
}

func (m *Millis) MarshalJSON() ([]byte, error) {
return json.Marshal(time.Time(*m).UnixMilli())
func (m Millis) MarshalJSON() ([]byte, error) {
return json.Marshal(time.Time(m).UnixMilli())
}

// Nanos represents a Unix time in nanoseconds since January 1, 1970 UTC.
Expand All @@ -269,6 +269,6 @@ func (n *Nanos) UnmarshalJSON(data []byte) error {
return nil
}

func (n *Nanos) MarshalJSON() ([]byte, error) {
return json.Marshal(time.Time(*n).UnixNano())
func (n Nanos) MarshalJSON() ([]byte, error) {
return json.Marshal(time.Time(n).UnixNano())
}

0 comments on commit 5511c91

Please sign in to comment.