scrapinghub / scrapinghub/dateparser

Feature Request - MDY or DMY based on locale?

Open
#602 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Type: Enhancement
Dominant language
Python
Stars
2.9k
Forks
520
Avg merge
22h 56m
Merged PRs (30d)
6

Description

I know there is language-based default for MDY/DMY, but is it possible to add support to locales? For example, en-gb should have DMY, but language "en" is MDY. I tried passing in the region as suggested in the docs but it didn't work as expected:
dateparser.parse("1/12", languages=["en"], region="gb") datetime.datetime(2019, 1, 12, 0, 0) dateparser.parse("1/12", languages=["en"], region="us") datetime.datetime(2019, 1, 12, 0, 0)

I'm unsure if this is a bug or asking for a new feature.

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 two dateparser.parse examples with languages=["en"] and regions "gb" and "us". Trace how the region argument affects locale-based date ordering; done means en-gb parses "1/12" as DMY while en-us retains MDY, with coverage for both cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
internationalization
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.