scrapinghub / scrapinghub/dateparser
Inconsistent behaviour between search_dates and parse
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 520
- Avg merge
- 22h 56m
- Merged PRs (30d)
- 6
Description
this test was performed on the 17th Feb 2019. "On Monday" refers to then next Monday (18th Feb).
parse seems to be correct -> datetime(2019, 2, 18, 7, 0), but search_dates interprets the 7 as a month.
>>> dateparser.parse("on Monday at 7am", settings={'PREFER_DATES_FROM': 'future'})
datetime.datetime(2019, 2, 18, 7, 0)
>>> search_dates("on Monday at 7am", settings={'PREFER_DATES_FROM': 'future'})
[('on Monday at 7am', datetime.datetime(2019, 7, 17, 0, 0))]
If I use 7:00 it's working fine. 7, 7am or 7 am are all inconsistent.
Tested with:
- dateparser (0.7.1) and (0.7.0)
- Python 3.6.5
- Linux kernel 4.14.65, x86-64
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
Reproduce the discrepancy using Python with dateparser.parse and search_dates for "on Monday at 7am", "7", and "7:00", using the future-date setting. Trace how search_dates handles the time token compared with parse; done means all equivalent time forms return the same intended datetime.
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
- 45/100