Closed ParthGandhi closed 8 years ago
On the changelog for the python-dateutil==2.5.2 they say they fixed a bug regarding dayfirst and yearfirst. https://github.com/dateutil/dateutil/blob/master/NEWS
https://github.com/dateutil/dateutil/pull/229/commits/2d42e046d55b9fbbc0a2f41ce83fb8ec5de2d28b
Looking forward to know more about this.
I got an error of "ValueError: month must be in 1..12" from dateutil
File "/usr/local/lib/python2.7/site-packages/pynamodb/models.py", line 394, in refresh self._deserialize(item_data) File "/usr/local/lib/python2.7/site-packages/pynamodb/models.py", line 1142, in _deserialize setattr(self, name, attr_instance.deserialize(value)) File "/usr/local/lib/python2.7/site-packages/pynamodb/attributes.py", line 260, in deserialize print parse(value).datetime File "/usr/local/lib/python2.7/site-packages/delorean/interface.py", line 68, in parse dt = capture(datetime_str, dayfirst=dayfirst, yearfirst=yearfirst) File "/usr/local/lib/python2.7/site-packages/dateutil/parser.py", line 1170, in parse return DEFAULTPARSER.parse(timestr, kwargs) File "/usr/local/lib/python2.7/site-packages/dateutil/parser.py", line 580, in parse ret = default.replace(repl) ValueError: month must be in 1..12 and repl = {u'hour': 22, u'month': 28, u'second': 20, u'microsecond': 600703, u'year': 2016, u'day': 3, u'minute': 38}
+1 on this
A quick fix for this to prevent breaks would be to set dayfirst's default value to False, also it is strange that they don't deal with yearfirst flag at all and ideally it should take priority since it was the default
I wont have time to look at this till monday, but I will fix it soon.
Closing this as a duplicate of #87.
Theres a bug when parsing date strings in the latest release.
In a new virtual env:
but the docs say that the output should be
Delorean(datetime=datetime.datetime(2013, 5, 6), timezone='UTC')
(which is the correct thing to do according to ISO 8601).Installing
python-dateutil==2.5.1
fixes the problem, but i'm not sure if the bug is indelorean
or on their end.