scrapinghub / scrapinghub/dateparser

%w | %W and %V | %u format string directives are not supported?

Open
#1,242 0 comments 0 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

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

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

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.