dateparser
dateparser copied to clipboard
REQUIRE_PARTS should support 'hour' and 'minute'
The setting 'REQUIRE_PARTS' is a nice and clean way to ensure the date contains parts. However, it only supports 'year', 'month', 'day'. Thus, it is currently not possible to use dateparser to just get hour and minute (without date) reliably.
The problem is that dateparser always returns a datetime object, where 'hour' and 'minute' default to 0. Thus, parsing a date like "2020-10-10" and then checking the hour and minute of the result will give the time(hour=0, minute=0). Of course one could ignore all results that have 0 in 'hour' and 'minute', but then parsing '0:00' (a valid time) would not work anymore. The two cases are currently indistinguishable.
I guess the best way to fix would be to support 'hour' and 'minute' in 'REQUIRE_PARTS'.