scrapinghub / scrapinghub/dateparser

Search dates fails depending on whitespaces around prefix ":"

Open
#768 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

search_dates Type: Bug
Dominant language
Python
Stars
2.9k
Forks
520
Avg merge
22h 56m
Merged PRs (30d)
6

Description

Version:

  • dateparser==0.76

How to reproduce:

# parsed date is correct
search_dates("Date 22.06.2020", languages=["de"], settings={'DATE_ORDER': 'DMY'})
> [('22.06.2020', datetime.datetime(2020, 6, 22, 0, 0))]

# parsed date is wrong (prefix " :")
search_dates("Date :22.06.2020", languages=["de"], settings={'DATE_ORDER': 'DMY'})
> [('22.06.2020', datetime.datetime(1900, 1, 1, 2, 2))]

# parsed date is different, but still wrong (prefix ":")
search_dates("Date:22.06.2020", languages=["de"], settings={'DATE_ORDER': 'DMY'})
> [('2020', datetime.datetime(2020, 8, 12, 0, 0))]

# parsed date is correct (prefix ": ")
search_dates("Date: 22.06.2020", languages=["de"], settings={'DATE_ORDER': 'DMY'})
> [('22.06.2020', datetime.datetime(2020, 6, 22, 0, 0))]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the four search_dates examples from the issue against dateparser 0.76, then trace the search_dates parsing path. Add coverage for the whitespace variants around the colon and confirm each returns the expected 22 June 2020 date.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.