From 5dc724dd4de7cc66c2750fc3af0e0458d8347d5c Mon Sep 17 00:00:00 2001 From: MinchinWeb Date: Mon, 13 Nov 2017 20:20:11 -0700 Subject: Don't break when system timezone is UTC --- .travis.yml | 2 ++ jrnl/DayOneJournal.py | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 37afaca9..3c476bb9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,6 @@ +sudo: false language: python +cache: pip python: - "2.7" - "3.3" diff --git a/jrnl/DayOneJournal.py b/jrnl/DayOneJournal.py index f4365db2..c2fd74fb 100644 --- a/jrnl/DayOneJournal.py +++ b/jrnl/DayOneJournal.py @@ -51,7 +51,13 @@ 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: + # if the system timezone is set to UTC, + # pytz.timezone.utcoffset() breaks when given the + # arg `is_dst` + 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() for tag in dict_entry.get("Tags", [])] -- cgit v1.2.3