1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Dateparser: parse future dates by default (closes #89)

This commit is contained in:
Steffo 2019-09-22 02:09:39 +02:00
parent 35a7d34bad
commit e8eaaf3a25
3 changed files with 7 additions and 3 deletions

View file

@ -364,7 +364,9 @@ class MmCommand(Command):
except InvalidInputError:
timestring, title, description = args.match(r"\s*(.+?)\s*\n\s*([^\n]+)\s*\n?\s*(.+)?\s*", re.DOTALL)
try:
dt: typing.Optional[datetime.datetime] = dateparser.parse(timestring)
dt: typing.Optional[datetime.datetime] = dateparser.parse(timestring, settings={
"PREFER_DATES_FROM": "future"
})
except OverflowError:
dt = None
if dt is None:

View file

@ -59,7 +59,9 @@ class ReminderCommand(Command):
date_str, reminder_text = args.match(r"\s*(.+?)\s*\n\s*([^\n]+)\s*")
try:
date: typing.Optional[datetime.datetime] = dateparser.parse(date_str)
date: typing.Optional[datetime.datetime] = dateparser.parse(date_str, settings={
"PREFER_DATES_FROM": "future"
})
except OverflowError:
date = None
if date is None:

View file

@ -1 +1 @@
semantic = "5.0a56"
semantic = "5.0a57"