mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 16:48:31 +02:00
Don't break when system timezone is UTC
This commit is contained in:
parent
779a8f4ddf
commit
5dc724dd4d
2 changed files with 9 additions and 1 deletions
|
@ -1,4 +1,6 @@
|
||||||
|
sudo: false
|
||||||
language: python
|
language: python
|
||||||
|
cache: pip
|
||||||
python:
|
python:
|
||||||
- "2.7"
|
- "2.7"
|
||||||
- "3.3"
|
- "3.3"
|
||||||
|
|
|
@ -51,7 +51,13 @@ class DayOne(Journal.Journal):
|
||||||
except (KeyError, pytz.exceptions.UnknownTimeZoneError):
|
except (KeyError, pytz.exceptions.UnknownTimeZoneError):
|
||||||
timezone = tzlocal.get_localzone()
|
timezone = tzlocal.get_localzone()
|
||||||
date = dict_entry['Creation Date']
|
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 = Entry.Entry(self, date, text=dict_entry['Entry Text'], starred=dict_entry["Starred"])
|
||||||
entry.uuid = dict_entry["UUID"]
|
entry.uuid = dict_entry["UUID"]
|
||||||
entry._tags = [self.config['tagsymbols'][0] + tag.lower() for tag in dict_entry.get("Tags", [])]
|
entry._tags = [self.config['tagsymbols'][0] + tag.lower() for tag in dict_entry.get("Tags", [])]
|
||||||
|
|
Loading…
Add table
Reference in a new issue