-
-
Notifications
You must be signed in to change notification settings - Fork 54
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
Timestamptz should use toUtc().toIso8601String() #364
Comments
👋 @orestesgaolin This library is created and maintained by me, @budde377. Please consider supporting my work and ensure our survival by donating here. |
Thank you for creating this issue. Date-times are complex and very hard to generalise. I would advice anyone to review the DateTime provided and determine if it meets the requirements of their setup and implement appropriate parsers. Changing the underlying implementation might cause a lot of issues for existing users, and as I said are probably not going to work for everyone, so I am reluctant to change it. |
Thanks for clarification, I understand your concern. By having the issue here I hope some other folks stumble upon it and make their converters aware of timezone. Do you mind if I update the readme with one more example of converter? |
That would be very useful - please feel free! |
There's a type
timestamptz
in PostgreSQL database that includes a tz information (timezone offset). When using it with default DateTime as type in build runner configuration, it may lead to errors where timezone gets lost.build.yaml:
In Dart if DateTime is in the local timezone of the device the call to
toIso8601String()
results with a string withoutZ
in the local timezone of the device. When sent via graphql mutation to a PostgreSQL database it will be interpreted as if this was in the UTC timezone.I suggest that graphql_codegen should include default
timestamptz
converter, e.g. something like:The text was updated successfully, but these errors were encountered: