Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: add PREFER_TIME_OF_DAY in settings #802

Open
monatis opened this issue Sep 29, 2020 · 4 comments
Open

Feature request: add PREFER_TIME_OF_DAY in settings #802

monatis opened this issue Sep 29, 2020 · 4 comments

Comments

@monatis
Copy link

monatis commented Sep 29, 2020

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 called PREFER_TIME_OF_DAY might be useful just like PREFER_DAY_OF_MONTH. For example, a date string tomorrow is parsed as 24 hours from now. With PREFER_TIME_OF_DAY introduced, it can be parsed as a preferred time of day (e.g., 9:00 a.m.).

Thanks.

@noviluni
Copy link
Collaborator

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)

@monatis
Copy link
Author

monatis commented Sep 29, 2020

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.

@Gallaecio
Copy link
Member

Gallaecio commented Sep 30, 2020

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 #778 is merged (e.g. if date_data.period == "day").

@Bubu
Copy link

Bubu commented Dec 5, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants