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:
parent
35a7d34bad
commit
e8eaaf3a25
3 changed files with 7 additions and 3 deletions
|
@ -364,7 +364,9 @@ class MmCommand(Command):
|
||||||
except InvalidInputError:
|
except InvalidInputError:
|
||||||
timestring, title, description = args.match(r"\s*(.+?)\s*\n\s*([^\n]+)\s*\n?\s*(.+)?\s*", re.DOTALL)
|
timestring, title, description = args.match(r"\s*(.+?)\s*\n\s*([^\n]+)\s*\n?\s*(.+)?\s*", re.DOTALL)
|
||||||
try:
|
try:
|
||||||
dt: typing.Optional[datetime.datetime] = dateparser.parse(timestring)
|
dt: typing.Optional[datetime.datetime] = dateparser.parse(timestring, settings={
|
||||||
|
"PREFER_DATES_FROM": "future"
|
||||||
|
})
|
||||||
except OverflowError:
|
except OverflowError:
|
||||||
dt = None
|
dt = None
|
||||||
if dt is None:
|
if dt is None:
|
||||||
|
|
|
@ -59,7 +59,9 @@ class ReminderCommand(Command):
|
||||||
date_str, reminder_text = args.match(r"\s*(.+?)\s*\n\s*([^\n]+)\s*")
|
date_str, reminder_text = args.match(r"\s*(.+?)\s*\n\s*([^\n]+)\s*")
|
||||||
|
|
||||||
try:
|
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:
|
except OverflowError:
|
||||||
date = None
|
date = None
|
||||||
if date is None:
|
if date is None:
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
semantic = "5.0a56"
|
semantic = "5.0a57"
|
||||||
|
|
Loading…
Reference in a new issue