scrapinghub / dateparser

python parser for human readable dates
BSD 3-Clause "New" or "Revised" License
2.55k stars 465 forks source link

Dateparser returning None when using filler words. #678

Closed cysabi closed 4 years ago

cysabi commented 4 years ago
>>> import dateparser
>>> dateparser.parse('Saturday May 16th at 8.30pm UTC')
>>> 
noviluni commented 4 years ago

This happens because the point (.) doesn't work as time delimiter and there is already an issue to track this bug: https://github.com/scrapinghub/dateparser/issues/643

You can fix it by changing the point by a colon:

>>> dateparser.parse('Saturday May 16th at 8:30pm UTC')
datetime.datetime(2020, 5, 16, 20, 30, tzinfo=<StaticTzInfo 'UTC'>)

As a temporary workaround, you could also use str.replace('.', ':') with the date string.

Closed as duplicate of: https://github.com/scrapinghub/dateparser/issues/643

Thanks for giving your feedback @LeptoFlare