You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As I said, I can work around this, but I figured I create this issue to see if this is something that should be fixed in Go, or if not, and the issue is closed, anyone else running into this can at least find the issue and know what's going on 👍
The text was updated successfully, but these errors were encountered:
Actually, reading through the RFC again, I think Go is correct to not support comma-separated fraction seconds. The part I copied is from the Appendix A. ISO 8601 Collected ABNF appendix, while 5.6. Internet Date/Time Format doesn't mention the comma, and in fact states:
The following profile of ISO 8601 [ISO8601] dates SHOULD be used in
new protocols on the Internet. This is specified using the syntax
description notation defined in [ABNF].
So it seems like this is working as intended, and I should watch out for using --iso8601=ns when using GNU's date.
The quoted section of RFC 3339 is from Appendix A where the RFC tries to explain what ISO 8601 is.
The grammar for RFC 3339 is defined in section 5.6, and it is defined as a "profile of ISO 8601", which I interpret as being a particular sub-set of the ISO 8601 grammar. In particular, it does not allow for commas.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?What did you do?
What did you expect to see?
What did you see instead?
I ran across this while I was combining a small go utility with some unix utilities. One of those utilities was GNU's
date
, which I used as follows:I was surprised to see a comma (
,
) to denote the fractional seconds.Now, interestingly enough, if I use
--rfc-3339=ns
, it returns a dot (.
):I dug into the RFC3339 spec, and found that using a comma is perfectly valid:
Time: time-hour = 2DIGIT ; 00-24 time-minute = 2DIGIT ; 00-59 time-second = 2DIGIT ; 00-58, 00-59, 00-60 based on ; leap-second rules + time-fraction = ("," / ".") 1*DIGIT time-numoffset = ("+" / "-") time-hour [[":"] time-minute] time-zone = "Z" / time-numoffset timeopt-hour = "-" / (time-hour [":"]) timeopt-minute = "-" / (time-minute [":"]) timespec-hour = time-hour [[":"] time-minute [[":"] time-second]] timespec-minute = timeopt-hour time-minute [[":"] time-second] timespec-second = "-" timeopt-minute time-second timespec-base = timespec-hour / timespec-minute / timespec-second time = timespec-base [time-fraction] [time-zone] iso-date-time = date "T" time
As I said, I can work around this, but I figured I create this issue to see if this is something that should be fixed in Go, or if not, and the issue is closed, anyone else running into this can at least find the issue and know what's going on 👍
The text was updated successfully, but these errors were encountered: