Skip to content

Fix non-padded month parsing for ISO-8601. Also added test. #287

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tersers
Copy link

@tersers tersers commented Oct 18, 2018

No description provided.

@tersers
Copy link
Author

tersers commented Oct 18, 2018

Weird, these ran fine on my machine. Will fix!

@tersers
Copy link
Author

tersers commented Oct 20, 2018

Fixes #286

I noticed a documentation issue in the parsing/__init__.py's COMMON regex, where it mentions support for dash-separated dates but does not implement it in the regex. This was corrected and elaborated on with other examples, and the regex was changed to support dashes.

@sdispater
Copy link
Collaborator

I am pretty sure the ISO-8601 spec does not allow non-padded months: https://en.wikipedia.org/wiki/ISO_8601#Calendar_dates

@tersers
Copy link
Author

tersers commented Oct 29, 2018

Agreed, which is why the change is reflected in the common parser rather than the ISO-8601 parser. I understand the user could unwittingly provide an incorrect ISO-8601 string which would fail to be parsed by the ISO-8601 parser but processed just fine by the common parser. If there is a mechanism to strictly enforce ISO-8601 parsing then this commit increases the flexibility of the rest of the library without harming ISO-8601 compliance.

As an aside, I notice an unnecessary print in my commit. I'll remove it later tonight.

@jamesmyatt
Copy link

How do you know that "2011-8" means August 2011 rather than 8 Jan 2011?

@tersers
Copy link
Author

tersers commented Oct 31, 2018

As you would expect, there's no clear distinction between the two. However, there is some freedom since this string is handled by the common parser.

With that said, another question comes to mind: how much flexibility does the common parser have, and is there a way to specify strict ISO-8601 parsinig or common parsing?

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 this pull request may close these issues.

4 participants