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

AsTime() on a nil pointer converts to Jan. 1st, 1970 at midnight UTC #1846

Open
antlai-temporal opened this issue Feb 25, 2025 · 0 comments
Open
Labels
bug Something isn't working

Comments

@antlai-temporal
Copy link
Contributor

The protobuf library maps a nil timestamp to Jan. 1st, 1970 at midnight UTC and makes IsZero() false. One side effect is that the cli cardOmitEmpty and omitEmpty no longer filter timestamps that have not been initialized. This is also a problem for users of the raw grpc API.

(*timestamppb.Timestamp)(nil).AsTime().IsZero() // FALSE!

The solution is to check with IsValid() before calling AsTime()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant