mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 16:48:31 +02:00
Fixes time parsing, closes #32
This commit is contained in:
parent
4850828e07
commit
4a1312a70b
2 changed files with 8 additions and 0 deletions
|
@ -3,6 +3,7 @@ Changelog
|
||||||
|
|
||||||
### 0.2.4 (May 24, 2012)
|
### 0.2.4 (May 24, 2012)
|
||||||
|
|
||||||
|
* [Fixed] Dates such as "May 3" will now be interpreted as being in the past if the current day is at least 28 days in the future
|
||||||
* [Fixed] Bug where composed entry is lost when the journal file fails to load
|
* [Fixed] Bug where composed entry is lost when the journal file fails to load
|
||||||
* [Changed] Changed directory structure and install scripts (removing the necessity to make an alias from `jrnl` to `jrnl.py`)
|
* [Changed] Changed directory structure and install scripts (removing the necessity to make an alias from `jrnl` to `jrnl.py`)
|
||||||
|
|
||||||
|
|
|
@ -241,6 +241,13 @@ class Journal:
|
||||||
else:
|
else:
|
||||||
date = datetime(*date[:6])
|
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
|
return date
|
||||||
|
|
||||||
def new_entry(self, raw, date=None):
|
def new_entry(self, raw, date=None):
|
||||||
|
|
Loading…
Add table
Reference in a new issue