scrapinghub / scrapinghub/dateparser
Broken logic while parse 'Today' type of string with the time offset
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 520
- Avg merge
- 22h 56m
- Merged PRs (30d)
- 6
Description
Hi. I found some bug while parsing the date. I will try to explain with examples.
In every parse, we use time offset (important, TIMEZONE must be more than your own).
For example, right now 23:00 and our timezone is +0300.
we parse the string "26.10.2018 05:28 PM" with timezone +0400 to our timezone. This time dateparser work right:
datetime.datetime(2018, 10, 26, 16, 28)
But if we will parse the string "Today 05:28 PM" with timezone +0400 to our timezone, dateparser will make mistake:
datetime.datetime(2018, 10, 27, 16, 28).
I guess, that this mistake appears from using datetime.datetime.now() when converting "Today" and converting timezone from our server time. It is not correct.
Please, can you fix this mistake?
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
Start by reproducing the two examples in the issue using the stated timezone offset, comparing the explicit date with the "Today" input. Trace the relative-date parsing and timezone conversion entry points; done means "Today 05:28 PM" resolves to the same intended calendar day as the explicit-date case.
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