Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(bigquery): align return time.Time values to UTC #9411

Merged
merged 1 commit into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion bigquery/value.go
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,7 @@ func convertBasicType(val string, typ FieldType) (Value, error) {
if err != nil {
return nil, err
}
return time.UnixMicro(i), nil
return time.UnixMicro(i).UTC(), nil
case DateFieldType:
return civil.ParseDate(val)
case TimeFieldType:
Expand Down
5 changes: 5 additions & 0 deletions bigquery/value_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ func TestConvertTime(t *testing.T) {
t.Errorf("#%d: got:\n%v\nwant:\n%v", i, g, w)
}
}
// Ensure that the times are returned in UTC timezone.
// https://github.com/googleapis/google-cloud-go/issues/9407
if gotTZ := got[0].(time.Time).Location(); gotTZ != time.UTC {
t.Errorf("expected time zone UTC: got:\n%v", gotTZ)
}
}

func TestConvertSmallTimes(t *testing.T) {
Expand Down