Skip to content

Feature request: support specifiying time zone by full name #93

@vr2262

Description

@vr2262

dateutil.parser.parse can parse all the time formats acceptable to Postgres except for this one:

2003-04-12 04:05:06 America/New_York

(from http://www.postgresql.org/docs/9.4/static/datatype-datetime.html#DATATYPE-DATETIME-TIME-TABLE)

>>> import dateutil.parser
>>> dateutil.parser.parse('2003-04-12 04:05:06 America/New_York')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/viktor/.virtualenvs/rewrite/lib/python3.4/site-packages/dateutil/parser.py", line 748, in parse
    return DEFAULTPARSER.parse(timestr, **kwargs)
  File "/home/viktor/.virtualenvs/rewrite/lib/python3.4/site-packages/dateutil/parser.py", line 310, in parse
    res, skipped_tokens = self._parse(timestr, **kwargs)
TypeError: 'NoneType' object is not iterable

I tried passing a dictionary for the tzinfos parameter with a key for 'America/New_York', but it fails with the same error. I believe it fails because of the forward slash and underscore in the time zone.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions