0

Is there any logic to the results below? How can they be avoided?

dateparser.parse('6/16/21 11:00 ma')

Returns 8/7/21 2:14 PM. This is wrong.

dateparser.parse('6/16/21 11:00 eb')

Returns 6/21/16 11:00 PM. This is wrong, and we should prefer that the eb is uninterpretable and dateparser.parse returns None.

dateparser.parse('6/16/21 11:00 so')

Returns 6/21/16 11:00 AM. Again, this is wrong, and we should prefer dateparser.parse to return None.

1 Answers1

0

Check out settings= parameter of dateparser.parse function.

These settings can be made out of multiple different options. I think STRICT_PARSING and REQUIRE_PARTS options are what you need

Alexey S. Larionov
  • 6,555
  • 1
  • 18
  • 37