Skip to content

fix: allow 'N {interval} from now' (#502) #1271

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jakeogh
Copy link

@jakeogh jakeogh commented May 17, 2025

This is a copy of PR #642 which fixes #502. I'm not sure why it was closed, or if this is the right way to re-submit it. Afaict it's a general fix that works in all cases.

Before:

$ python -c "from dateparser import parse; from datetime import datetime ; print(parse('in 2 days', settings={'RELATIVE_BASE': datetime.now()}))"
2025-05-19 00:34:29.964320

$ python -c "from dateparser import parse; from datetime import datetime ; print(parse('2 days fron now', settings={'RELATIVE_BASE': datetime.now()}))"
None

After:

$ python -c "from dateparser import parse; from datetime import datetime ; print(parse('in 2 days', settings={'RELATIVE_BASE': datetime.now()}))"
2025-05-19 00:34:29.964320

$ python -c "from dateparser import parse; from datetime import datetime ; print(parse('2 days fron now', settings={'RELATIVE_BASE': datetime.now()}))"
2025-05-19 00:34:29.964320

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

Successfully merging this pull request may close these issues.

"x days from now" relative no longer functions as of 0.7
1 participant