From 4cc74fed3633a110a6e69bd68ef1f8e74ff3614d Mon Sep 17 00:00:00 2001 From: MinchinWeb Date: Fri, 2 Aug 2019 10:51:45 -0600 Subject: [PATCH] [DayOne] be explicit when dealing with UTC --- jrnl/DayOneJournal.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/jrnl/DayOneJournal.py b/jrnl/DayOneJournal.py index 9ddb87ef..361e91ee 100644 --- a/jrnl/DayOneJournal.py +++ b/jrnl/DayOneJournal.py @@ -51,16 +51,14 @@ class DayOne(Journal.Journal): except (KeyError, pytz.exceptions.UnknownTimeZoneError): timezone = tzlocal.get_localzone() date = dict_entry['Creation Date'] - try: + if timezone != pytz.utc: 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, text=dict_entry['Entry Text'], starred=dict_entry["Starred"]) entry.uuid = dict_entry["UUID"] entry._tags = [self.config['tagsymbols'][0] + tag.lower().replace(" ", "_") for tag in dict_entry.get("Tags", [])]