From 45290136fc41caef84a3d8e68fc7fd69394f1775 Mon Sep 17 00:00:00 2001 From: MinchinWeb Date: Thu, 1 Aug 2019 22:19:00 -0600 Subject: [PATCH] [Dayone] don't break if the system timezone is UTC --- jrnl/DayOneJournal.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/jrnl/DayOneJournal.py b/jrnl/DayOneJournal.py index 83eb6788..0462c144 100644 --- a/jrnl/DayOneJournal.py +++ b/jrnl/DayOneJournal.py @@ -52,7 +52,16 @@ 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) + try: + date = date + timezone.utcoffset(date, is_dst=False) + except TypeError: + # The above converts the date to UTC. However, if the + # timezone is already in UTC, you can't call + # timezone.utcoffset() with the is_dst parameter + # ("utcoffset() got an unexpected keyword argument + # 'is_dst'"), but we already have our date in UTC, so + # nothing more needs to be done. + pass entry = Entry.Entry( self, date,