scrapinghub / scrapinghub/dateparser
Search dates fails with french language selector if string contains "-"
Open
Nobody has claimed this yet.
search_dates
Type: Bug - Language
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 520
- Avg merge
- 22h 56m
- Merged PRs (30d)
- 6
Description
Version:
- dateparser==0.7.6
How to reproduce:
# correctly parsed date
search_dates("HelloDate 26.09.2019", languages=["de", "fr"], settings={'DATE_ORDER': 'DMY'})
> [('26.09.2019', datetime.datetime(2019, 9, 26, 0, 0))]
# the "-" in "Hello-Date" leads to a wrong date
search_dates("Hello-Date 26.09.2019", languages=["de", "fr"], settings={'DATE_ORDER': 'DMY'})
> [('2019', datetime.datetime(2019, 8, 12, 0, 0))]
# omitting french language leads to correctly parsed date again
search_dates("Hello-Date 26.09.2019", languages=["de"], settings={'DATE_ORDER': 'DMY'})
Out[9]: [('26.09.2019', datetime.datetime(2019, 9, 26, 0, 0))]
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the reported search_dates examples with dateparser 0.7.6, then trace the search_dates entry point and language handling for French when the input contains a hyphen. Add a regression test covering "Hello-Date 26.09.2019" with German and French, and confirm it returns the full date rather than 2019.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, internationalization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100