scrapinghub / scrapinghub/dateparser

search_dates() wrong result for 12:xx am

Open
#894 2 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

search_dates() gives wrong results for times between 12:00 am and 12:59 am (hour is off by 12), but parse() is correct.

>>> import dateparser
>>> from dateparser.search import search_dates 
>>> dateparser.__version__
'1.0.0'
>>> 
>>> search_dates('March 3, 2021, 12:47 am')
[('March 3, 2021, 12:47 am', datetime.datetime(2021, 3, 3, 12, 47))]
>>>
>>> dateparser.parse('March 3, 2021, 12:47 am')
datetime.datetime(2021, 3, 3, 0, 47)

Python version is 3.8.9, OS is Ubuntu 20.10

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 reproducing the reported Python 3.8.9 example with search_dates('March 3, 2021, 12:47 am') and compare it with dateparser.parse(). Trace the search_dates path to find where the hour changes, then add regression coverage showing that 12:xx am remains in the midnight hour while parse() stays correct.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.