mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-06-29 14:06:14 +02:00
Fixes time parsing, closes #32
This commit is contained in:
parent
7b0829121f
commit
9a9a80cd8e
2 changed files with 8 additions and 0 deletions
|
@ -241,6 +241,13 @@ class Journal:
|
|||
else:
|
||||
date = datetime(*date[:6])
|
||||
|
||||
# Ugly heuristic: if the date is more than 4 weeks in the future, we got the year wrong.
|
||||
# Rather then this, we would like to see parsedatetime patched so we can tell it to prefer
|
||||
# past dates
|
||||
dt = datetime.now() - date
|
||||
if dt.days < -28:
|
||||
date = date.replace(date.year - 1)
|
||||
|
||||
return date
|
||||
|
||||
def new_entry(self, raw, date=None):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue