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: mention reference date used for formatting in time.Parse #48757
Comments
It does say in the 2nd sentence of the function's doc:
Of course is not advisable to duplicate the information in the doc of every function that uses the format. |
Hiding a key documentation point in a comment in an example function is close to the HHGTG: https://www.goodreads.com/quotes/40705-but-the-plans-were-on-display-on-display-i-eventually I am not asking it to be copied everywhere, merely to be added to the documentation of the Parse function. |
? I'm referring to the section at the top of the package: https://pkg.go.dev/time#pkg-constants. It's hard to see how anyone scrolling through the documentation of The fixed layout string is used in |
The explanation in https://pkg.go.dev/time@go1.17.1#Time.Format example is great. Now I know what the layout string is it makes sense. Without that information it is very confusing. |
I don't think there's anything to do here. If you read the signature for The examples are that that, examples, and not suited for the function doc itself. Note that |
Timed out in state WaitingForInfo. Closing. (I am just a bot, though. Please speak up if this is a mistake or you have the requested information.) |
👍 I'm learning Go, and this magical ref. date was very weird to me (compared to C# format string patterns). I really couldn't get why my chosen format pattern didn't work. Only after googling towards the site mentioned in the opening comment, I came to understand you have to use this specific date in order to let your composed format work. This is after reading:
We (at least I) probably look for the pattern to use first, only to realise that the pattern + the exact ref. values are needed. Indeed in all the examples from the sites mentioned in the above, they use the same ref. date. But again it's not very clear that is THE ref date one should use. |
As of go1.17.1
This is a documentation issue so environment and recreation issues are irrelevent.
The documentation for the time.Parse fails to mention the "magical reference date"
(https://programming.guide/go/format-parse-string-time-date-example.html)
This makes working with date parsing much harder than it needs to be.
The text was updated successfully, but these errors were encountered: