-
Notifications
You must be signed in to change notification settings - Fork 523
Closed
Milestone
Description
Currently, if you the result of a tzinfos call explicitly returns None, that will throw an error:
>>> from dateutil.parser import parse
>>> parse('2017-02-03 12:40 MGX', tzinfos={'MGX': None})
...
ValueError: Offset must be tzinfo subclass, tz string, or int offset.
>>> parse('2017-02-03 12:40 RDT', tzinfos={'XXX': None})
[...] UnknownTimezoneWarning: tzname RDT identified but not understood. Pass `tzinfos`
argument in order to correctly return a timezone-aware datetime. In a future version,
this raise an exception.
category=UnknownTimezoneWarning)
datetime.datetime(2014, 2, 3, 2, 3)The whole point of #540 was that implicitly silently failing was a bad behavior, but you should certainly be able to opt in to not caring about the time zone by returning None.
Note: As an aside, there's a typo I didn't notice there, it says "In a future version, this raise an exception", should be "this will raise an exception."