scrapinghub / scrapinghub/dateparser

Add a way to tell if date is considered ambiguous

Open
#1,099 0 comments 0 reactions 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 have a use-case where I want to inform the user that some date string is ambiguous. It would be great if DateDataParser could expose this as an additional property on DateData.

from dateparser.date import DateDataParser

parser = DateDataParser()
parser.get_date_data('11.12.13') 

# as a result
DateData(date_obj=datetime.datetime(2013, 11, 12, 0, 0), period='day', locale='en', ambiguous=True)

Knowing the date order used would be helpful too (as proposed in #733).

I'm not sure if the ambiguous property makes sense if we know or assume any locale? Maybe it should be set only if PREFER_LOCALE_DATE_ORDER: False.

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 with DateDataParser.get_date_data and the DateData structure shown in the issue, then review how locale and PREFER_LOCALE_DATE_ORDER affect date interpretation. Compare the proposed ambiguous property with the date-order discussion in #733; done means exposing a consistent result for ambiguous inputs without changing existing parsing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 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.