Add UTC support for failing DayOne tests (#785)

* [Dayone] don't break if the system timezone is UTC
* [DayOne] re-enable tests that were failing on Travis
* [DayOne] change as per code review to avoid `except: pass`
This commit is contained in:
MinchinWeb 2020-02-08 13:34:52 -07:00
parent 8b7ebe2dcd
commit 66027e7746
2 changed files with 6 additions and 13 deletions

View file

@ -52,7 +52,11 @@ class DayOne(Journal.Journal):
except (KeyError, pytz.exceptions.UnknownTimeZoneError):
timezone = tzlocal.get_localzone()
date = dict_entry["Creation Date"]
date = date + timezone.utcoffset(date, is_dst=False)
# convert the date to UTC rather than keep messing with
# timezones
if timezone.zone != "UTC":
date = date + timezone.utcoffset(date, is_dst=False)
entry = Entry.Entry(
self,
date,