dateparser icon indicating copy to clipboard operation
dateparser copied to clipboard

Add a way to tell if date is considered ambiguous

Open slykar opened this issue 1 year ago • 0 comments

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.

slykar avatar Nov 17 '22 17:11 slykar