akoumjian / datefinder

Find dates inside text using Python and get back datetime objects
http://datefinder.readthedocs.org/en/latest/
MIT License
635 stars 167 forks source link

Month and date determined incorrectly #141

Open SteveSmirnoff opened 3 years ago

SteveSmirnoff commented 3 years ago

There is no way to specify an expected format (eg dd-mm-yyyy) In my text the format is dd-mm-yyyy, but dates are extracted incorrectly

max(list(datefinder.find_dates(text='30.11.2020 ', base_date=datetime.datetime(1500, 1, 1, 0, 0)))).strftime("%d.%m.%Y") Out: '30.11.2020'

max(list(datefinder.find_dates(text='10.11.2020 ', base_date=datetime.datetime(1500, 1, 1, 0, 0)))).strftime("%d.%m.%Y") Out: '11.10.2020' Expected: '10.11.2020'