mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-21 05:28:31 +02:00
[DayOne] be explicit when dealing with UTC
This commit is contained in:
parent
a55bbcf44e
commit
4cc74fed36
1 changed files with 1 additions and 3 deletions
|
@ -51,16 +51,14 @@ 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']
|
||||||
try:
|
if timezone != pytz.utc:
|
||||||
date = date + timezone.utcoffset(date, is_dst=False)
|
date = date + timezone.utcoffset(date, is_dst=False)
|
||||||
except TypeError:
|
|
||||||
# The above converts the date to UTC. However, if the
|
# The above converts the date to UTC. However, if the
|
||||||
# timezone is already in UTC, you can't call
|
# timezone is already in UTC, you can't call
|
||||||
# timezone.utcoffset() with the is_dst parameter
|
# timezone.utcoffset() with the is_dst parameter
|
||||||
# ("utcoffset() got an unexpected keyword argument
|
# ("utcoffset() got an unexpected keyword argument
|
||||||
# 'is_dst'"), but we already have our date in UTC, so
|
# 'is_dst'"), but we already have our date in UTC, so
|
||||||
# nothing more needs to be done.
|
# nothing more needs to be done.
|
||||||
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().replace(" ", "_") for tag in dict_entry.get("Tags", [])]
|
entry._tags = [self.config['tagsymbols'][0] + tag.lower().replace(" ", "_") for tag in dict_entry.get("Tags", [])]
|
||||||
|
|
Loading…
Add table
Reference in a new issue