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: support Decimal Comma for fractional seconds #43823

Closed
djaglowski opened this issue Jan 21, 2021 · 8 comments
Closed

time: support Decimal Comma for fractional seconds #43823

djaglowski opened this issue Jan 21, 2021 · 8 comments

Comments

@djaglowski
Copy link

@djaglowski djaglowski commented Jan 21, 2021

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

$ go version
go version go1.15.3 darwin/amd64

Does this issue reproduce with the latest release?

Yes, I can reproduce it on the playground

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

GOARCH=amd64
GOOS=darwin
go env Output
$ go env
GOARCH="amd64"
GOOS="darwin"
...

What did you do?

Attempt to parse a date/time string containing milliseconds preceded by a decimal comma. Example:
https://play.golang.org/p/wxEOUEVvgaV

What did you expect to see?

Time is 02/12/2019 15:45:48,746

What did you see instead?

parsing time "02/12/2019 15:45:48,746" as "02/01/2006 15:04:05,000": cannot parse "746" as ",000"

Additional Context

ISO_8601 states that decimal comma is a supported, even preferred, value for the separator between seconds and fractional seconds.

Related Issues:

@gopherbot gopherbot added this to the Proposal milestone Jan 21, 2021
@ianlancetaylor ianlancetaylor added this to Incoming in Proposals Jan 21, 2021
@rsc rsc moved this from Incoming to Active in Proposals Jan 27, 2021
@rsc
Copy link
Contributor

@rsc rsc commented Jan 27, 2021

The proposal here is to accept 05,000 as the same as 05.000 in a time format (and similarly for other numbers of zeros).
Presumably dot would continue to only match dot, and comma would only match comma.
Do I have that right?

@rsc
Copy link
Contributor

@rsc rsc commented Jan 27, 2021

/cc @robpike

@djaglowski
Copy link
Author

@djaglowski djaglowski commented Jan 27, 2021

@rsc That's correct.

@robpike
Copy link
Contributor

@robpike robpike commented Jan 28, 2021

Seems reasonable on its own, although I am wary of what might follow. Internationalization was never the goal of this package.

@rsc
Copy link
Contributor

@rsc rsc commented Feb 3, 2021

It's definitely not a goal to do full internationalization, but ISO-8601 does recognize , as a decimal fraction separator, so at least we are following a defined standard for times. And it does not have any other internationalization-related changes, so that's a clear line we can refer to if people want other changes.

In particular, I don't think this opens us to internationalized month and day names. Those will stay just the English set.

@rsc
Copy link
Contributor

@rsc rsc commented Feb 3, 2021

Based on the discussion above, this proposal seems like a likely accept.
— rsc for the proposal review group

@rsc rsc moved this from Active to Likely Accept in Proposals Feb 3, 2021
@rsc rsc moved this from Likely Accept to Accepted in Proposals Feb 10, 2021
@rsc
Copy link
Contributor

@rsc rsc commented Feb 10, 2021

No change in consensus, so accepted. 🎉
This issue now tracks the work of implementing the proposal.
— rsc for the proposal review group

@rsc rsc changed the title proposal: time: support Decimal Comma for fractional seconds time: support Decimal Comma for fractional seconds Feb 10, 2021
@rsc rsc modified the milestones: Proposal, Backlog Feb 10, 2021
@odeke-em odeke-em self-assigned this Mar 8, 2021
@gopherbot
Copy link

@gopherbot gopherbot commented Mar 12, 2021

Change https://golang.org/cl/300996 mentions this issue: time: support "," as separator for fractional seconds

@gopherbot gopherbot closed this in f02a26b Mar 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Proposals
Accepted
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants