Skip to content

Fix day+month+year dates collapsing to the whole month - #2791

Merged
nicoloboschi merged 1 commit into
vectorize-io:mainfrom
dimonnld:day-precision-fix
Jul 20, 2026
Merged

Fix day+month+year dates collapsing to the whole month#2791
nicoloboschi merged 1 commit into
vectorize-io:mainfrom
dimonnld:day-precision-fix

Conversation

@dimonnld

Copy link
Copy Markdown
Contributor

Problem

extract_period() (the deterministic period table) runs before dateparser and matches <month> <year>. When a day number precedes the month, the table still fires and widens the query to the whole month, dropping the day:

meeting on 13 July 2024  ->  2024-07-01 .. 2024-07-31   (should be 2024-07-13)

This is language-agnostic — it affects every language in the period table, and it bites English today.

Fix

Guard the month-table match with a day-number check: if a day precedes the month, skip the table and let dateparser resolve the exact date (dateparser handles 13 July 2024 correctly).

Tests

Added test_query_analyzer_day_month_year_stays_exact (English case). Verified locally on both dateparser versions:

  • 1.2.2 — the version pinned in the lock / run by CI
  • 1.4.1 — the version actually shipped inside the ghcr.io/vectorize-io/hindsight:0.8.4 image

Full test_query_analyzer.py is green (383 passed) on both.

Context

Split out of #2767 per @benfrank241's review, so this correctness fix can land independently of the Russian-coverage change. #2767 now stacks on this PR.

extract_period() runs before dateparser and matches "<month> <year>", so
"meeting on 13 July 2024" was widened to 2024-07-01..2024-07-31 and the day
was lost. Skip the month-table match when a day number precedes the month,
letting dateparser resolve the exact date instead.

Language-agnostic: affects every language in the period table (English shown
in the test). Split out of vectorize-io#2767 per review so the correctness fix can land
independently of the Russian-coverage change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants