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

Timezone of "-00" and "-00:00" should be invalid per ISO8601 3.4.2 #7

Closed
gavbaa opened this issue Jun 12, 2020 · 0 comments · Fixed by #8
Closed

Timezone of "-00" and "-00:00" should be invalid per ISO8601 3.4.2 #7

gavbaa opened this issue Jun 12, 2020 · 0 comments · Fixed by #8

Comments

@gavbaa
Copy link
Contributor

gavbaa commented Jun 12, 2020

Wikipedia's breakdown of ISO8601 Section 3.4.2:

An offset of zero, in addition to having the special representation "Z", can also be stated numerically as "+00:00", "+0000", or "+00". However, it is not permitted to state it numerically with a negative sign, as "−00:00", "−0000", or "−00". The section dictating sign usage (section 3.4.2 in the 2004 edition of the standard) states that a plus sign must be used for a positive or zero value, and a minus sign for a negative value. Contrary to this rule, RFC 3339, which is otherwise a profile of ISO 8601, permits the use of "-00", with the same denotation as "+00" but a differing connotation.

package main

import (
	"github.com/relvacode/iso8601"
	"github.com/davecgh/go-spew/spew"
)

func main() {
	t, err := iso8601.ParseString("2020-01-02T16:20:00.999-00")
	spew.Dump(t, err)
}

Outputs

(time.Time) 2020-01-02 16:20:00.999 +0000 +0000
(interface {}) <nil>

when it should be outputting an error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants