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

There are no exception during parse wrong year in datetime string #353

Closed
heappro opened this issue Mar 22, 2017 · 2 comments
Closed

There are no exception during parse wrong year in datetime string #353

heappro opened this issue Mar 22, 2017 · 2 comments

Comments

@heappro
Copy link

heappro commented Mar 22, 2017

Parser will not raise exceptions If you specify wrong year "201A".
Sample code:

from dateutil import parser

origin = "201A-01-01T23:58:39.239769+03:00"
parsed = parser.parse(origin)
print("origin={}".format(origin))
print("parsed={}".format(parsed.isoformat()))

Output:
origin=201A-01-01T23:58:39.239769+03:00
parsed=2017-03-22T23:58:39.239769+03:00

I use python3.5 on Mac.
dateutil version="2.6.0"

@pganssle pganssle added this to the Bugfix release milestone Apr 17, 2017
@pganssle
Copy link
Member

Possibly related to #326 and #360 (though maybe completely different).

@jbrockmendel
Copy link
Contributor

The problem here is that in the i=0 step of the parsing, info.ampm(l[i + 1]) is not None and so we do two incorrect things: 1) set res.hour = 201, and 2) later overwrite that without checking if an hour already exists.

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

No branches or pull requests

3 participants