Closed alanhamlett closed 10 years ago
This also happens when you create Delorean from others Delorean's datetime if timezone is different than UTC:
>>> import delorean
>>> d1 = delorean.Delorean(timezone='America/Chicago')
>>> d2 = delorean.Delorean(d1.datetime)
>>> d1.next_day(1)
Delorean(datetime=2013-10-24 05:28:02.624143-05:00, timezone=America/Chicago)
>>> d2.next_day(1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/swistakm/dev/env-tebe-packets/local/lib/python2.7/site-packages/delorean/dates.py", line 311, in next_day
return Delorean(datetime=dt, timezone=self._tz)
File "/home/swistakm/dev/env-tebe-packets/local/lib/python2.7/site-packages/delorean/dates.py", line 198, in __init__
self._dt = localize(datetime, timezone)
File "/home/swistakm/dev/env-tebe-packets/local/lib/python2.7/site-packages/delorean/dates.py", line 141, in localize
tz = timezone(tz)
File "/home/swistakm/dev/env-tebe-packets/local/lib/python2.7/site-packages/pytz/__init__.py", line 180, in timezone
raise UnknownTimeZoneError(zone)
pytz.exceptions.UnknownTimeZoneError: 'CDT'
>>>
This causes problems when using
last_*
methods off the Delorean, for example: