scrapinghub / scrapinghub/dateparser
When mixing h/m/s, results are absolute even though using "in"
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 520
- Avg merge
- 22h 56m
- Merged PRs (30d)
- 6
Description
>>> str(dateparser.parse("in 3h10m", languages=["en"], settings={"PREFER_DATES_FROM": "future"}))
'2020-05-15 03:10:00'
>>> str(dateparser.parse("in 3h 10m", languages=["en"], settings={"PREFER_DATES_FROM": "future"}))
'2020-05-15 01:27:24.920769'
I feel like those two should be identical. Same result without settings or languages specified.
This might be due to https://github.com/scrapinghub/dateparser/blob/master/dateparser_data/supplementary_language_data/date_translation_data/en.yaml#L48
Removing it fixes the issue
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 two examples first, then inspect dateparser_data/supplementary_language_data/date_translation_data/en.yaml around line 48. Verify how the translation entry affects spaced and unspaced h/m/s expressions. Done means both inputs produce equivalent relative results and the regression is covered by an appropriate test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100