Visitar URL original
Polish month names are not recognized (date reduced to the year) · Issue #206 · adbar/htmldate · GitHub
Skip to content

Polish month names are not recognized (date reduced to the year) #206

Open

Description

@MSliwa01

htmldate 1.11.0 (dateparser 1.4.3, Python 3.13)

Polish dates written with a month name are not extracted when they are part of a longer string: extensive mode returns only the year, fast mode returns nothing.

from htmldate import find_date

doc = '<html><body><p class="date">Opublikowano: 12 października 2025</p></body></html>'
find_date(doc)                          # '2025-01-01', expected '2025-10-12'
find_date(doc, extensive_search=False)  # None, expected '2025-10-12'

The German and English equivalents (Veröffentlicht: 12. Oktober 2025, Published: 12 October 2025) return 2025-10-12 in both modes. The same happens through trafilatura 2.3.1 (extract_metadata(...).date == '2025-01-01').

Cause: regex_parse only knows the names in MONTHS (EN/FR/DE/ID/TR), so Polish dates depend on dateparser. With STRICT_PARSING, dateparser rejects the string because of the prefix ("Opublikowano:" means "Published:"), and the year-only fallback wins. Fast mode never calls dateparser.

A PR adding the Polish month names to MONTHS follows.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions