-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: no Parse format for GNU style RFC3339 #25937
Comments
/cc @rsc |
While there is a note in RFC3339 saying that applications may choose to replace the T with a space, this is not what the formal ABNF specification there supports. The underlying ISO 8601 standards mandates the use of the T. Since any application choosing to support space can easily define their own constants, I don't think new constants in time are needed. |
I don't see a need to change anything here. We appear to follow the RFC. It's easy to adapt. |
Taken directly from the RFC:
Yes, the ABNF doesn't included characters other than
As such, I would argue that the time library doesn't fully conform to RFC3339. |
@crawford This issue is closed, and we don't track comments on closed issues. You can write formats yourself to do whatever you need. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.10.3 linux/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?Ubuntu 18.04, amd64
What did you do?
Attempted to time.Parse the result of 'date --utc --rfc-3339=ns':
What did you expect to see?
Parsing to succeed
What did you see instead?
Failure, due to an old disagreement about the RFC: http://lists.gnu.org/archive/html/bug-coreutils/2006-05/msg00019.html
GNU coreutils team maintain whitespace is allowed, but the Go library requires the 'T' separator between the date and time components of the string representation.
Options to allow interoperability between GNU style and Go style RFC-3339 complient strings would be to either relax the Go parsing, or provide alternative predefined styles in the time package (time.RFC3339GNU and time.RFC3339NanoGNU, or time.GNU3339 and time.GNU3339Nano, or similar)
The text was updated successfully, but these errors were encountered: