scrapinghub / scrapinghub/dateparser
%w | %W and %V | %u format string directives are not supported?
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 520
- Avg merge
- 22h 56m
- Merged PRs (30d)
- 6
Description
Assuming dateparser should support all format string directives supported by python, the following code demonstrates discrepancies in how its parsing results deviate from datetime's strptime:
import datetime as dt
import dateparser as dp
date = '01.24-1'
date_format = '%W.%y-%w'
date_iso = '01.2024-1'
date_format_iso = '%V.%G-%u'
print('Non-ISO date:')
print('Datetime: %s' % dt.datetime.strptime(date, date_format).date())
print('Dateparser: %s' % dp.parse(date, [date_format]).date())
print('ISO date:')
print('Datetime: %s' % dt.datetime.strptime(date_iso, date_format_iso).date())
print('Dateparser: %s' % dp.parse(date_iso, [date_format_iso]).date())
outputs:
Non-ISO date:
Datetime: 2024-01-01
Dateparser: 2024-10-30
ISO date:
Datetime: 2024-01-01
Dateparser: 2024-10-30
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 running the provided Python example and compare dateparser.parse with datetime.strptime for the %W/%w and %V/%u directives. Trace the format-string parsing path for these directives; done means both examples produce 2024-01-01, with regression coverage for the demonstrated inputs.
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
- 45/100