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
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
time: doesn't parse RFC3339 properly #9346
Time can't parse the layout constant for RFC3339 in the code itself.
For eg. Go playground link - http://play.golang.org/p/EJH53M__AH
Currently if there is any offset in time (non UTC time), time formats it in RFC3339 as - +07:00 instead of Z07:00
If Z07:00 is given, it gives an error
For posterity: the time package docs describe this layout conversion with the Z (near the bottom of the linked section), which is that it shows "Z" instead of a time offset if the timezone is UTC, and +hh:mm or -hh:mm otherwise. Since this is one of the few examples of the reference time format not being an actually valid time, I can see the confusion.
Thanks for the encouragement @ianlancetaylor. I received a good answer on stackoverflow just today that was more helpful for me than the docs, probably because it used complete real examples and was specific to the particular layout string I was using:
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 <email@example.com> TryBot-Result: Gobot Gobot <firstname.lastname@example.org> Reviewed-by: Ian Lance Taylor <email@example.com>