Open monatis opened 4 years ago
Hi @monatis !
Thank you for your comment. I'm going to think about it and return to you.
For then meanwhile, you can use something like:
import dateparser
>>> dateparser.parse('tomorrow').replace(hour=9, minute=0, second=0, microsecond=0)
datetime.datetime(2020, 9, 30, 9, 0)
Hi @noviluni, thank you for the tip! I'll think through it --it might be the solution when applied with some extra conditionals to detect if a time expression is missing.
Hi @noviluni, thank you for the tip! I'll think through it --it might be the solution when applied with some extra conditionals to detect if a time expression is missing.
That should be easy once https://github.com/scrapinghub/dateparser/pull/778 is merged (e.g. if date_data.period == "day"
).
I'm looking for a similar thing. I just wanted to add that currently specifying a day of the week gives a time of 0:00. It would be nice to have this apply to that as well.
Hi, Thank you for this great project --we find it quite useful for our conversational AI projects. Let me explain the feature I'm suggesting: In current / default behavior, when time is missing it is interpreted as the current time of day. A flag in
settings
calledPREFER_TIME_OF_DAY
might be useful just likePREFER_DAY_OF_MONTH
. For example, a date stringtomorrow
is parsed as 24 hours from now. WithPREFER_TIME_OF_DAY
introduced, it can be parsed as a preferred time of day (e.g., 9:00 a.m.).Thanks.