Skip to content

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

@deepthi-mck
Copy link

Can we get this merged? Would like to have support for "* from now" format

@Gallaecio
Copy link
Member

Closing and reopening to see if CI triggers.

@Gallaecio Gallaecio closed this Oct 6, 2025
@Gallaecio Gallaecio reopened this Oct 6, 2025
@codecov
Copy link

codecov bot commented Oct 6, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.58%. Comparing base (bdc57d3) to head (a795ec0).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1271   +/-   ##
=======================================
  Coverage   96.58%   96.58%           
=======================================
  Files         235      235           
  Lines        2866     2866           
=======================================
  Hits         2768     2768           
  Misses         98       98           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Gallaecio
Copy link
Member

It seems tests do not pass.

a = (<tests.test_freshness_date_parser.TestFreshnessDateDataParser testMethod=test_relative_past_dates_038_7_years_from_now>,)
kw = {}

    @wraps(func)
    def standalone_func(*a, **kw):
>       return func(*(a + p.args), **p.kwargs, **kw)
E       TypeError: test_relative_past_dates() got an unexpected keyword argument 'in_future'

.tox/min-all/lib/python3.9/site-packages/parameterized/parameterized.py:620: TypeError

Fixes test failure by moving "from now" test cases from test_relative_past_dates
to test_relative_future_dates.
@jakeogh
Copy link
Author

jakeogh commented Oct 18, 2025

The test cases were decorating the wrong function, they should pass now.

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

3 participants