-
Notifications
You must be signed in to change notification settings - Fork 214
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
Add support for local timezone on ISO8601 output #135
base: master
Are you sure you want to change the base?
Conversation
to be able to provide a appropriate time representation the fix conversion to UTC is removed. Also the time.RFC3339 format is used instead of a custom format constant
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
|
I signed it! |
CLAs look good, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that the JSON API spec has a recommendation for using ISO 8601, I think we should try to stick to ISO 8601.
My simple understanding of ISO 8601 vs RFC 3339 is that they are very closely related however RFC 3339 is a simplification/profile of ISO 8601. I'm inclined to think that this library should aim to support ISO 8601 and that custom/wrapper golang types should be used to serialize RFC 3339 when needed by your use case.
It seems like what you are really after is the correct serialization/deserialization of the time zone information that was specified in the originating time value (whether that be in the JSON payload or a go variable of type time.Time). I think there should be a way to accomplish this without switching from ISO 8601 to RFC 3339.
@aren55555 yeah, the main goal of this PR is to allow a correct serialization/deserialization of the timezone information. According to the date formatting: But if you favour the custom constant, it is absolutely no problem to use an updated version of it: What do you think? |
@aren55555 any update on this PR? |
I'm pretty sure |
@aren55555 Parsing the In the response part I tried to remove the |
I ran into the need for this as well, forcing times to UTC was unexpected. |
To be able to provide a appropriate time representation the fix
conversion to UTC is removed.
time.Time
holds the information about the timezone corresponding to the actual object and this timezone should be used for jsonapi representation.Also the
time.RFC3339
format is used instead of the custom format constant.