Skip to content

False positives when searching dates #582

Closed

Description

@g-kozulis

OS: Windows 10.0.17763.805
dateparser version: 0.7.2

When using the search_dates() function some numerical and punctuation mark combinations that don't resemble any date format I've ever seen get picked up as dates.

To reproduce run the following code and replace <false positive> with any one of the following:

  • 8: 100M2_
  • 100M
  • 10,00 2
  • 19,60 5
  • 73 20
from dateparser.search import search_dates

search_dates("The following isn't a correct date <false positive>")

Activity

  1. murray-minito commented on Nov 20, 2019

    @murray-minito

    Same here on OSX 10.15 with version 0.7.2

    Here are some examples of results that should not be dates

    search_dates(text,languages=['en'], settings={'STRICT_PARSING': True,'PREFER_DATES_FROM': 'past','DATE_ORDER': 'DMY'}, add_detected_language=True)

    -- Clearly wrong
    ('32° 34’S', datetime.datetime(2013, 10, 16, 23, 59, 7), 'en')
    ('123°', datetime.datetime(1900, 1, 1, 1, 2, 3), 'en')
    ('6005', datetime.datetime(2000, 6, 5, 0, 0)
    ('000', datetime.datetime(1900, 1, 1, 0, 0), 'en')
    ('of 629', datetime.datetime(1900, 1, 1, 6, 2, 9), 'en')
    ('>21', datetime.datetime(1900, 1, 1, 2, 1), 'en')

    -- I can kind of see where it is getting this but I think it is wrong to do it
    ('3533', datetime.datetime(2033, 5, 3, 0, 0), 'en')

    -- I have lots of numbers in these docs. It should not pick them up and 'make' a date from them
    ('538400', datetime.datetime(8400, 3, 5, 0, 0), 'en')

  2. noviluni commented on Sep 21, 2020

    @noviluni
    Contributor

    FYI some cases will be fixed in the next version (after merging this: #786)

  3. gavishpoddar commented on Apr 1, 2021

    @gavishpoddar
    Contributor

    Seems #786 has been merged, can you please close this issue

  4. Gallaecio commented on Apr 5, 2021

    @Gallaecio
    Contributor

    Does #786 fix all cases reported here? Otherwise, it makes sense to keep this open.

  5. AdrianAtZyte commented on Sep 28, 2026

    @AdrianAtZyte
    Member

    Most of the cases reported by @murray-minito were fixed in #786, released in dateparser 1.0.0 (2020-10-29). The remaining ones (100M, 34’S, 10,00 2, 73 20, …) are parsed the same way by dateparser.parse(), as relative expressions like "100 minutes ago" or as numeric dates, so they are not specific to search_dates. Settings like STRICT_PARSING, REQUIRE_PARTS or PARSERS can filter them out. I am closing this one since it has become a mix of unrelated cases; please, open a new issue for any specific case you think should not be parsed as a date.

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

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions