python-dateutil icon indicating copy to clipboard operation
python-dateutil copied to clipboard

Hour incremented before declared

Open spence opened this issue 11 years ago • 0 comments

>>> import datetime
>>> import dateutil
>>> dt_str = datetime.datetime(2014, 1, 1, 13).strftime('%p %-I:%M')  # 'PM 1:00'
>>> dateutil.parser.parse(dt_str)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "dateutil/parser.py", line 697, in parse
    return DEFAULTPARSER.parse(timestr, **kwargs)
  File "dateutil/parser.py", line 301, in parse
    res = self._parse(timestr, **kwargs)
  File "dateutil/parser.py", line 557, in _parse
    res.hour += 12
TypeError: unsupported operand type(s) for +=: 'NoneType' and 'int'

I'm aware this is not the official repo.

spence avatar Sep 06 '14 16:09 spence