scrapinghub / scrapinghub/dateparser

YYYY-MM-DD interpreted as YYYY-DD-MM

Open
#1,199 7 comments 2 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

YYYY-MM-DD interpreted as YYYY-DD-MM for arabic, but also looks like in other languages which prefer DMY order, but this looks strange -- it seems that if year is first, then we should ignore DMY / MDY and just use YMD for all locales?

Examples:

>>> dateparser.parse('2023-11-08', languages=['ar'])
datetime.datetime(2023, 8, 11, 0, 0)

>>> dateparser.parse('2023-11-08', languages=['en'], region='GB')
datetime.datetime(2023, 8, 11, 0, 0)

>>> dateparser.parse('2023-11-08', languages=['en'], region='US')
datetime.datetime(2023, 11, 8, 0, 0)

>>> dateparser.parse('2023-11-08', languages=['en'])
datetime.datetime(2023, 11, 8, 0, 0)

Side note: in reality US also has MDY date order, so if we'd interpret en as en-US and if it had MDY set, then we'd parse a lot more dates incorrectly.

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 reproducing the four dateparser.parse examples in the issue and trace how locale-specific date ordering is selected for Arabic and English regions. Compare the current results with the requested behavior: an input written as YYYY-MM-DD should consistently produce the corresponding year, month, and day across locales. No file or test path is named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
internationalization, localization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.