Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
time: RFC3339 format parsing is both too lax and too strict #20869
As of Go 1.8.3, the RFC3339 format has several inconsistencies with the actual RFC when parsing a string:
Also, it does not parse leap seconds, which are explicitly allowed under the standard, but that seems more like an intentional design decision.
In reporting this, I am assuming the omission of RFC3339 from the comment:
suggests that you should be able to parse all time formats permitted by it.
For #9346 #22135 explicitly state under layout constants that they are not valid time values for Parse. Also add examples of parsing valid RFC3339 values and the layout to the example for time.Parse. Fix capitalisation of time.Parse and Time.Format. For #20869 include RFC3339 in the list of layouts that do not accept all the time formats allowed by RFCs (lowercase z). This does not fully address #20869. Fixes #9346 Fixes #22135 Change-Id: Ia4c13e5745de583db5ef7d5b1688d7768bc42c1b Reviewed-on: https://go-review.googlesource.com/74231 Run-TryBot: Ian Lance Taylor <firstname.lastname@example.org> TryBot-Result: Gobot Gobot <email@example.com> Reviewed-by: Ian Lance Taylor <firstname.lastname@example.org>