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
time: Accept PT0S as valid Duration in time.ParseDuration #44681
Comments
Update: also decoding |
The docs for Do you want to turn it into a proposal for supporting ISO 8601 durations? |
Good question. Quick check seems to indicate that there's currently no library that supports both decoding Changing |
iso8601 uses uppercase while Go uses lowercase, so in theory no separate function is needed. However, Go has rejected supporting time intervals greater than an hour so I would consider it unlikely to accept full iso8601 durations |
If go and ISO duration use different case, one could decode both transparently using the same decoding function. This would be great for unmarshaling JSON. For encoding, as additional While this is not a proposal, I could update it if there‘s likelihood of interest. Reasoning is that there‘s currently no library that seems to support encoding and decoding of ISO durations, they are part of at least one emobility REST apis though. |
Note there is https://github.com/dylanmei/iso8601 or https://github.com/ChannelMeter/iso8601duration so it may not be necessary to have this in the language. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Parse zero duration:
https://play.golang.org/p/m5cKJNEHD-n
What did you expect to see?
According to https://en.wikipedia.org/wiki/ISO_8601:
What did you see instead?
The text was updated successfully, but these errors were encountered: