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
bupjae opened this issue Oct 20, 2016 · 3 comments
Closed

time: uppercase day/month names are not recognized in format strings #17523

bupjae opened this issue Oct 20, 2016 · 3 comments
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone

Comments

@bupjae
Copy link

bupjae 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 .

@bupjae bupjae changed the title time: Formatting sting specification is not completely described time: Formatting string specification is not completely described Oct 20, 2016
@cznic
Copy link
Contributor

cznic 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
Copy link
Contributor

@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 The path to resolution is known, but the work has not been done. label Oct 20, 2016
@quentinmit quentinmit added this to the Go1.8Maybe milestone Oct 20, 2016
@quentinmit quentinmit added NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. and removed NeedsFix The path to resolution is known, but the work has not been done. labels Oct 20, 2016
@gopherbot
Copy link

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

@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.
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests

4 participants