-
Notifications
You must be signed in to change notification settings - Fork 18k
Invalid example for RFC3339 time layout - Invalid according to RFC and also time.Parse fails #71377
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
Comments
Also as per RFC - https://datatracker.ietf.org/doc/html/rfc3339#section-5.8, Correct layout is |
I went through the issue - #9346, and stackoverflow discussion.
The failure of |
Change https://go.dev/cl/643258 mentions this issue: |
All the above issues and Stackoverflow discussion agree with that fact that package documentation for RFC3339 is wrong, and So, the documentation and example should be fixed. |
This issue is indeed the duplicate of the above mentioned issues, but the above mentioned issues have been closed without a conclusion / fix. I have created a PR for this - #71378 |
@seankhliao Can you reopen this issue (Please see my above comments) |
we've repeatedly stated that we need extra control over how exactly to parse or format the time. it's also stated in the docs:
this is working as intended. the assumption that a layout time string has to be a valid time is unfounded. |
This comment has been minimized.
This comment has been minimized.
This doesn't make sense. If its not a valid time string for the given layout, what is the purpose of the layout string value ? Why dont just define Its clearly stated in the comments of the code https://github.com/golang/go/blob/master/src/time/format.go
Then,
I dont understand how having an invalid format example gives any extra control to parse the time.
This is not true, |
as stated above, and in the docs, a layout is not necessarily a valid timestamp, it only describes the format which the for questions please refer to https://github.com/golang/go/wiki/Questions |
Go version
go version go1.21.6 darwin/arm64
Output of
go env
in your module/workspace:What did you do?
Used the provided example for RFC3339 time layout (https://github.com/golang/go/blob/master/src/time/format.go#L119) , and tried to parse it via
time.Parse
Go code
What did you see happen?
What did you expect to see?
Correct output with parse done.
The text was updated successfully, but these errors were encountered: