mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-20 21:18:32 +02:00
[DayOne] change as per code review
to avoid `except: pass`
This commit is contained in:
parent
1c65952770
commit
5425b35cb5
1 changed files with 4 additions and 9 deletions
|
@ -52,16 +52,11 @@ 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:
|
# convert the date to UTC rather than keep messing with
|
||||||
|
# timezones
|
||||||
|
if timezone.zone != "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
|
|
||||||
# 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(
|
entry = Entry.Entry(
|
||||||
self,
|
self,
|
||||||
date,
|
date,
|
||||||
|
|
Loading…
Add table
Reference in a new issue