Skip to content

STRICT_PARSING failed with MM/YYYY format #850

Open

Description

@realizard

Hi,

I've noticed dateparser.parse("10/2017", settings={"STRICT_PARSING": True}) gives datetime.datetime(2017, 10, 10, 0, 0).

Is this the intended behavior? (even if the input string is missing a component) Are there any workarounds if I'd want it to output None?

Activity

  1. noviluni commented on Dec 3, 2020

    @noviluni
    Contributor

    Hi @realizard This is definitely a bug.

    I didn't check it further but it seems that it fails when the locale is zh. As a workaround, you can select a subset of languages without including zh, with languages=. For example:

    >>> dateparser.parse("10/2017", settings={"STRICT_PARSING": True}, languages=['en'])
    # it returns `None`
  2. added this to the 1.1.0 milestone on Dec 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions