scrapinghub / scrapinghub/dateparser
Interpreting time
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 520
- Avg merge
- 22h 56m
- Merged PRs (30d)
- 6
Description
HI, thanks for date parser. I am experimenting with collecting freehand dates and times entered into resource tags. I have tried the following:
print(dateparser.parse('6/4/25 7', settings={'DATE_ORDER': 'DMY', 'PREFER_DAY_OF_MONTH': 'first', "PREFER_MONTH_OF_YEAR": "current"}))
None. --> was hoping for 6-Apr-2025 07:00:00
print(dateparser.parse('Monday', settings={'DATE_ORDER': 'DMY', 'PREFER_DAY_OF_MONTH': 'first', "PREFER_MONTH_OF_YEAR": "current"}))
2025-12-31 00:00:00 --> was hoping for 7-Apr-2025 00:00:00
print(dateparser.parse('6/4/25 0730', settings={'DATE_ORDER': 'DMY', 'PREFER_DAY_OF_MONTH': 'first', "PREFER_MONTH_OF_YEAR": "current"}))
0730-04-06 00:00:00
Something not right here, it has used the time component for the Year even though the '/25' and date order was specified. Anyway, thanks for the library, I think it is very useful.
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 three dateparser.parse examples from the issue, including the DMY settings and expected dates and times. Trace how date and time tokens are interpreted, then add regression coverage for the reported inputs and run the relevant test suite; done means the examples no longer return None, shift the weekday incorrectly, or treat 0730 as a year.
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
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100