-
Notifications
You must be signed in to change notification settings - Fork 495
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
Error parsing unambiguous dates #233
Comments
This was most certainly not an ambiguous change, and probably can be patched in a bugfix release. The 2.5.2 release doesn't have much in it (mainly it was just released to update the |
Note - if anyone goes to fix this before I get around to it, please work off the |
The fix in #234 only works when the day part of In 2.5.1: >>> import dateutil
>>> print dateutil.__version__
2.5.1
>>> from dateutil.parser import parse
>>> parse('2015-01-02')
datetime.datetime(2015, 1, 2, 0, 0)
>>> parse('2015-01-02', dayfirst=True)
datetime.datetime(2015, 1, 2, 0, 0)
>>> parse('2015-01-13', dayfirst=True)
datetime.datetime(2015, 1, 13, 0, 0) In 2.5.3: >>> import dateutil
>>> print dateutil.__version__
2.5.3
>>> from dateutil.parser import parse
>>> parse('2015-01-02')
datetime.datetime(2015, 1, 2, 0, 0)
>>> parse('2015-01-02', dayfirst=True)
datetime.datetime(2015, 2, 1, 0, 0)
>>> parse('2015-01-13', dayfirst=True)
datetime.datetime(2015, 1, 13, 0, 0) Delorean bug: myusuf3/delorean#87 |
@rupert I'm not sure I understand the issue. See my comments on #214 if you want |
Yes Day and month swapped in 2.5.3: >>> parse('2015-01-02', dayfirst=True)
datetime.datetime(2015, 2, 1, 0, 0) |
To be honest this is more a problem with delorean defaulting |
Just set it to That is the intended behavior change for dateutil version 2.5.2 - the combination of |
Yes setting it to
|
See dateutil/dateutil#233 (comment) Basically: dateutil used to parse 2013-03-01 as march 1, but due to a change in 2.5.2, they decided to start parsing it as january 3. It's to do with how they are trying to handle dates that look like yymmdd or ddmmyy, etc, and they seem to think there is an obscure but valid case where you'd want yyyyddmm. It's stupid but then relaxed parsing is a minefield anyway.
It seems in version 2.5.2, there started being problems parsing unambiguous dates that don't follow the specified dayfirst option:
In previous versions it would produce a valid date.
Was this an intended change?
The text was updated successfully, but these errors were encountered: