Skip to content

Commit

Permalink
types: return UTC time from Datetime.Time()
Browse files Browse the repository at this point in the history
Addresses IDX-479

Signed-off-by: philhassey <[email protected]>
  • Loading branch information
philhassey committed Dec 5, 2024
1 parent fb0f992 commit 84ee8af
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions types/datetime.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,9 @@ func (a Datetime) Milliseconds() int64 {
return a.value
}

// Time returns the time.Time representation of a Datetime.
// Time returns the UTC time.Time representation of a Datetime.
func (a Datetime) Time() time.Time {
return time.UnixMilli(a.value)
return time.UnixMilli(a.value).UTC()
}

func (v Datetime) hash() uint64 {
Expand Down
2 changes: 1 addition & 1 deletion types/datetime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func TestDatetime(t *testing.T) {
t.Parallel()
in := types.NewDatetime(time.UnixMilli(42))
got := in.Time()
want := time.UnixMilli(42)
want := time.UnixMilli(42).UTC()
testutil.Equals(t, got, want)
})

Expand Down

0 comments on commit 84ee8af

Please sign in to comment.