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

Timestamp parsing fails when offset omits colon #106

Open
joallard opened this issue Jan 31, 2018 · 0 comments
Open

Timestamp parsing fails when offset omits colon #106

joallard opened this issue Jan 31, 2018 · 0 comments

Comments

@joallard
Copy link

joallard commented Jan 31, 2018

While ISO8601 permits omission of colon separators anywhere,

YAML.parse("a: 2018-01-31T16:40:39-0500")
// Object { a: Date 2018-01-31T16:40:39.050Z }
// Incorrect: Offset without colon interpreted as decimal

YAML.parse("a: 2018-01-31T16:40:39.01-0500")
// Object { a: "2018-01-31T16:40:39.01-0500" }
// Failure: With decimal and non-colon offset, not parsed

YAML.parse("a: 2001-12-14t21:59:43.10-05:00")
// Object { a: Date 2001-12-15T02:59:43.100Z }
// Correct: With decimal and colon offset

YAML.parse("a: 2001-12-14t01:59:43-05:00")
// Object { a: Date 2001-12-14T06:59:43.000Z }
// Correct: Without decimal, with colon

(0.3.0)

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

No branches or pull requests

1 participant