mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-19 20:48:31 +02:00
Work if timezone is UTC
This commit is contained in:
parent
bee2bac2b4
commit
ea19458e7c
2 changed files with 7 additions and 3 deletions
|
@ -43,4 +43,4 @@ Feature: Multiple journals
|
|||
Scenario: Gracefully handle a config without a default journal
|
||||
Given we use the config "multiple_without_default.yaml"
|
||||
When we run "jrnl fork this repo and fix something"
|
||||
Then we should see the message "You have not specified a journal. Either provide a default journal in your config file, or specify one of your journals on the command line."
|
||||
Then the output should contain "You have not specified a journal. Either provide a default journal in your config file, or specify one of your journals on the command line."
|
||||
|
|
|
@ -7,7 +7,7 @@ from . import Journal
|
|||
from . import time as jrnl_time
|
||||
import os
|
||||
import re
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timedelta
|
||||
import time
|
||||
import fnmatch
|
||||
import plistlib
|
||||
|
@ -49,7 +49,11 @@ 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)
|
||||
if timezone != pytz.timezone('UTC'):
|
||||
time_offset = timezone.utcoffset(date)
|
||||
else:
|
||||
time_offset = timedelta(0)
|
||||
date = date + time_offset
|
||||
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", [])]
|
||||
|
|
Loading…
Add table
Reference in a new issue