scrapinghub / scrapinghub/dateparser

odd behaviour with plus sign

Open
#923 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Specifics: dateparser v1.0.0 && Python 3

Using now + <x> mins results in time subtraction rather than adding, which is odd and fails intuition

In [17]: dateparser.parse('now', languages=['en']).ctime()
Out[17]: 'Sat May 15 13:07:06 2021'

In [18]: dateparser.parse('now + 10 mins', languages=['en']).ctime()
Out[18]: 'Sat May 15 12:57:13 2021'

However, using the word in after the + sign seems to get the right result, but that also makes the now + unnecessary.

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

Reproduce the examples with dateparser v1.0.0 and Python 3, comparing now + 10 mins with the form using in. Trace how relative expressions containing a plus sign are interpreted. Done means the plus form adds the requested duration and a regression test covers this behavior.

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
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.