This commit is contained in:
Zhizhen He 2023-04-23 04:19:15 +08:00 committed by GitHub
parent ea6a5da3eb
commit 0b64d50f4b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View file

@ -34,7 +34,7 @@ def parse(
elif isinstance(date_str, datetime.datetime):
return date_str
# Don't try to parse anything with 6 or less characters and was parsed from the existing journal.
# Don't try to parse anything with 6 or fewer characters and was parsed from the existing journal.
# It's probably a markdown footnote
if len(date_str) <= 6 and bracketed:
return None
@ -83,7 +83,7 @@ def parse(
date = datetime.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
# Rather than this, we would like to see parsedatetime patched so we can tell it to prefer
# past dates
dt = datetime.datetime.now() - date
if dt.days < -28 and not year_present: