Skip to content
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: A colon is missing when formatting a time zone with seconds #8497

Closed
jstemmer opened this issue Aug 8, 2014 · 6 comments
Closed

time: A colon is missing when formatting a time zone with seconds #8497

jstemmer opened this issue Aug 8, 2014 · 6 comments
Milestone

Comments

@jstemmer
Copy link
Contributor

jstemmer commented Aug 8, 2014

What does 'go version' print?
go version devel +a4de97b5ea66 Fri Aug 08 16:20:20 2014 +0900 linux/amd64

What steps reproduce the problem?
Try to format a time zone with seconds using one of the colon layouts.
http://play.golang.org/p/CWRGALvwh9

What happened?
The time zone part is formatted as "+0019:32"

What should have happened instead?
The time zone part should be "+00:19:32"

Please provide any additional information below.

Here's a proposed CL to fix this:
https://golang.org/cl/126840043/
@cznic
Copy link
Contributor

cznic commented Aug 8, 2014

Comment 1:

From the docs[0]:
""""
Numeric time zone offsets format as follows:
-0700  ±hhmm
-07:00 ±hh:mm
Replacing the sign in the format with a Z triggers the ISO 8601 behavior of printing Z
instead of an offset for the UTC zone. Thus:
Z0700  Z or ±hhmm
Z07:00 Z or ±hh:mm
""""
The program uses "-07:00:00" for the zone format. That's is invalid as it's none of the
above supported formats.
  [0]: http://golang.org/pkg/time/#pkg-constants

@jstemmer
Copy link
Contributor Author

jstemmer commented Aug 8, 2014

Comment 2:

issue #4934 added support for parsing and formatting time zones with seconds, "-07:00:00"
is a valid zone format. If you remove the colons from the format layout in the
playground example I posted it will correctly print the time zone with seconds.

@ianlancetaylor
Copy link
Contributor

Comment 3:

Labels changed: added repo-main, release-go1.4.

Status changed to Accepted.

@ianlancetaylor
Copy link
Contributor

Comment 4:

https://golang.org/cl/126840043/

Status changed to Started.

@gopherbot
Copy link

Comment 5:

CL https://golang.org/cl/126840043 mentions this issue.

@robpike
Copy link
Contributor

robpike commented Aug 8, 2014

Comment 6:

This issue was closed by revision 298c623.

Status changed to Fixed.

@rsc rsc added this to the Go1.4 milestone Apr 14, 2015
@rsc rsc removed the release-go1.4 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jun 25, 2018
When formatting time zone offsets with seconds using the stdISO8601Colon
and stdNumColon layouts, the colon was missing between the hour and minute
parts.

Fixes golang#8497.

LGTM=r
R=golang-codereviews, iant, gobot, r
CC=golang-codereviews
https://golang.org/cl/126840043
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jul 9, 2018
When formatting time zone offsets with seconds using the stdISO8601Colon
and stdNumColon layouts, the colon was missing between the hour and minute
parts.

Fixes golang#8497.

LGTM=r
R=golang-codereviews, iant, gobot, r
CC=golang-codereviews
https://golang.org/cl/126840043
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants