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

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 (old) Jan 21, 2021
@rsc rsc moved this from Incoming to Active in Proposals (old) Jan 27, 2021
@rsc
Copy link
Contributor

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 commented Jan 27, 2021

/cc @robpike

@djaglowski
Copy link
Author

@rsc That's correct.

@robpike
Copy link
Contributor

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 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 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 (old) Feb 3, 2021
@rsc rsc moved this from Likely Accept to Accepted in Proposals (old) Feb 10, 2021
@rsc
Copy link
Contributor

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

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

@golang golang locked and limited conversation to collaborators Mar 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Development

No branches or pull requests

5 participants