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

Clarify handling of regex-based parsing #312

Closed
Ms2ger opened this issue Jan 13, 2020 · 5 comments · Fixed by #404
Closed

Clarify handling of regex-based parsing #312

Ms2ger opened this issue Jan 13, 2020 · 5 comments · Fixed by #404
Assignees

Comments

@Ms2ger
Copy link
Collaborator

Ms2ger commented Jan 13, 2020

We've got text like

  1. Let valid be true if dateTime matches the "datetime" regular expression in the polyfill and false otherwise.
  2. If valid is false, then
    1. Throw a RangeError exception.
  3. Let year, month, day, hour, minute, second, millisecond, microsecond, nanosecond be the respective parts of dateTime interpreted as decimal numbers.

That's not great. I don't know what the best solution is, though - perhaps creating actual JS RegExp objects? Thoughts welcome.

@littledan
Copy link
Member

In some other places, we reference a grammar and productions within the grammar. Can we do that here?

@ptomato
Copy link
Collaborator

ptomato commented Jan 14, 2020

Unfortunately, you have to purchase ISO 8601 to get the full text, so if we referenced something in ISO, our document would become less accessible.

From this openly available draft of ISO 8601-2 it seems that there is a grammar, but only for the extensions, not the main date/time format in ISO 8601-1. So we'd probably end up writing a grammar anyway.

@ptomato
Copy link
Collaborator

ptomato commented Jan 15, 2020

Ah, there's a grammar in https://www.ietf.org/rfc/rfc3339.txt appendix A.

@littledan
Copy link
Member

Yeah, we can cite RFC 3339 normatively here, rather than ISO 8601.

@Ms2ger
Copy link
Collaborator Author

Ms2ger commented Feb 19, 2020

Time zones are probably the hardest case here, since they have a couple of alternative syntaxes.

@ptomato ptomato self-assigned this Feb 25, 2020
ryzokuken pushed a commit that referenced this issue May 6, 2020
We specify our own grammar because what we have decided to accept is
different enough from both ISO 8601 and RFC 3339 that we cannot really
refer directly to either one. A list of where the differences are is
included in the grammar section of the spec.

Closes: #312
Closes: #198
Closes: #71
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

Successfully merging a pull request may close this issue.

3 participants