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: uppercase day/month names are not recognized in format strings #17523

Closed
BupjaeLee opened this issue Oct 20, 2016 · 3 comments

Comments

Projects
None yet
4 participants
@BupjaeLee
Copy link

commented Oct 20, 2016

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go 1.7

What operating system and processor architecture are you using (go env)?

play.golang.org

What did you do?

https://play.golang.org/p/ORGoq1knm0

What did you expect to see?

Tue Nov 10 2009
TUE NOV 10 2009

What did you see instead?

Tue Nov 10 2009
MON JAN 10 2009

While "Mon" and "Jan" are parsed as placeholder, I was surprised "MON" and "JAN" are not parsed.

The documentation https://golang.org/pkg/time/ is not sufficient to determine format string specification without examining source code https://golang.org/src/time/format.go .

@BupjaeLee BupjaeLee changed the title time: Formatting sting specification is not completely described time: Formatting string specification is not completely described Oct 20, 2016

@cznic

This comment has been minimized.

Copy link
Contributor

commented Oct 20, 2016

The documentation https://golang.org/pkg/time/ is not sufficient to determine format string specification without examining source code https://golang.org/src/time/format.go .

Let me disagree please. From the docs:

The reference time used in the layouts is the specific time:

Mon Jan 2 15:04:05 MST 2006

which is Unix time 1136239445. Since MST is GMT-0700, the reference time can be thought of as

01/02 03:04:05PM '06 -0700

To define your own format, write down what the reference time would look like formatted your way; see the values of constants like ANSIC, StampMicro or Kitchen for examples.

The format string in your example obviously is not 'what the reference time would look like formatted your way' b/c it uses MON instead of Mon etc, but nowhere is such thing documented to be allowed.

@quentinmit

This comment has been minimized.

Copy link
Contributor

commented Oct 20, 2016

@cznic This request seems reasonable to me; they're saying that "MON" is how they wanted the day to be formatted. We ought to either document the allowed symbols or support upper/title/lower case.

@quentinmit quentinmit changed the title time: Formatting string specification is not completely described time: uppercase day/month names are not recognized in format strings Oct 20, 2016

@quentinmit quentinmit added the NeedsFix label Oct 20, 2016

@quentinmit quentinmit added this to the Go1.8Maybe milestone Oct 20, 2016

@quentinmit quentinmit added NeedsDecision and removed NeedsFix labels Oct 20, 2016

@gopherbot

This comment has been minimized.

Copy link

commented Nov 2, 2016

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

@gopherbot gopherbot closed this in 3345802 Nov 3, 2016

@golang golang locked and limited conversation to collaborators Nov 3, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.