A range that opens at the anchor answers the anchor: "until easter", "before christmas", "hasta mañana"

Open
#659 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
52/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
python
Domain
backend

Research direction

Read _instant in ovos_date_parser/__init__.py and the holiday handling in ovos_date_parser/holidays.py, then review the linked locale tests in ovos-date-parser#638. Reproduce one failing case using the provided extract_datetime call and compare its output with the test assertion. The issue leaves the intended interpretation of ranges that begin at the anchor as a design decision; agree on that behavior before changing the adapter, then remove the strict xfail marks when the tests pass.

Written by the indexing model from the issue text.

Description

🤖 Auto-generated by Claude Opus 5.5 (claude-opus-5-5) via Claude Code — NOT human-reviewed. Verify before acting.

Observed

extract_datetime answers a range that opens at the anchor with its start, so "until easter", "before christmas" and "hasta mañana" give the anchor itself. chronologia reads each one as the range from now to the date, which is correct for a span. The adapter _instant picks the start of every span that is not a band or an exact time, and the holiday layer no longer replaces the answer.

ovos-date-parser routes every locale chronologia reads to chronologia (OpenVoiceOS/ovos-date-parser#638). Each row below is a test there that carries xfail(strict=True) with a link to this issue. When the row is fixed, the test passes, strict mode reports XPASS, and the mark comes off.

Expected

Each family below names the expected reading with its ruling or source. The test assertion column holds the value the test pins.

Reproduce

On chronologia 0.32.8a1 (PyPI), at the head of that pull request:

from datetime import datetime
from ovos_date_parser import extract_datetime

extract_datetime(TEXT, LANG, anchorDate=datetime.fromisoformat(ANCHOR))

The legacy column is the same call with the locale taken out of CHRONOLOGIA_LOCALES.

Verified by machine: every legacy and chronologia value was computed by running the call above. Not verified by a person: the expected values, which a model wrote.

Where

_instant in ovos_date_parser/__init__.py, and the holiday layer in ovos_date_parser/holidays.py. The legacy reader answered the date that the range reaches, with the preposition left over.

Rows

until-range-start: 8 tests

"until " and "before " answer the start of the range, the anchor. The tests pin the legacy answer: the date named, with the preposition left over. Which instant answers a range that opens at the anchor is a design question for the adapter, not a chronologia defect.

lang text anchor legacy reader chronologia 0.32.8a1 test assertion
es-ES hasta mañana 2026-10-17T12:00:00+01:00 2026-10-18 00:00:00 'hasta' 2026-10-17 12:00:00 '' AssertionError: datetime.datetime(2026, 10, 17, 12, 0) != datetime.datetime(2026, 10, 18, 0, 0)
en-US until easter 2026-09-25T12:00:00 2027-03-28 00:00:00 'until' 2026-09-25 12:00:00 '' AssertionError: assert (datetime.dat...5, 12, 0), '') == (datetime.dat..., 0), 'until') At index 0 diff: datetime.datetime(2026, 9, 25, 12, 0) != datetime.
en-US before christmas 2026-09-25T12:00:00 2026-12-25 00:00:00 'before' 2026-09-25 12:00:00 '' AssertionError: assert (datetime.dat...5, 12, 0), '') == (datetime.dat... 0), 'before') At index 0 diff: datetime.datetime(2026, 9, 25, 12, 0) != datetime.
fr-FR avant noël 2026-09-25T12:00:00 2026-12-25 00:00:00 'avant' 2026-09-25 12:00:00 '' AssertionError: assert (datetime.dat...5, 12, 0), '') == (datetime.dat..., 0), 'avant') At index 0 diff: datetime.datetime(2026, 9, 25, 12, 0) != datetime.
es-ES hasta navidad 2026-09-25T12:00:00 2026-12-25 00:00:00 'hasta' 2026-09-25 12:00:00 '' AssertionError: assert (datetime.dat...5, 12, 0), '') == (datetime.dat..., 0), 'hasta') At index 0 diff: datetime.datetime(2026, 9, 25, 12, 0) != datetime.
de-DE bis Weihnachten 2026-09-25T12:00:00 2026-12-25 00:00:00 'bis' 2026-09-25 12:00:00 '' AssertionError: assert (datetime.dat...5, 12, 0), '') == (datetime.dat... 0, 0), 'bis') At index 0 diff: datetime.datetime(2026, 9, 25, 12, 0) != datetime.
nl-NL tot kerst 2026-09-25T12:00:00 2026-12-25 00:00:00 'tot' 2026-09-25 12:00:00 '' AssertionError: assert (datetime.dat...5, 12, 0), '') == (datetime.dat... 0, 0), 'tot') At index 0 diff: datetime.datetime(2026, 9, 25, 12, 0) != datetime.
pt-PT até ao natal 2026-09-25T12:00:00 2026-12-25 00:00:00 'até ao' 2026-09-25 12:00:00 '' AssertionError: assert (datetime.dat...5, 12, 0), '') == (datetime.dat... 0), 'até ao') At index 0 diff: datetime.datetime(2026, 9, 25, 12, 0) != datetime.
ovos-date-parser tests
  • test/test_dates_es_siguiente_weekday.py::TestMananaIsTomorrowOrTheMorning::test_until_tomorrow
  • test/test_holidays_chronologia.py::test_a_preposition_alone_is_no_offset[de-DE-bis Weihnachten-expected7-bis]
  • test/test_holidays_chronologia.py::test_a_preposition_alone_is_no_offset[en-US-before christmas-expected1-before]
  • test/test_holidays_chronologia.py::test_a_preposition_alone_is_no_offset[en-US-until easter-expected0-until]
  • test/test_holidays_chronologia.py::test_a_preposition_alone_is_no_offset[es-ES-hasta navidad-expected5-hasta]
  • test/test_holidays_chronologia.py::test_a_preposition_alone_is_no_offset[fr-FR-avant no\xebl-expected3-avant]
  • test/test_holidays_chronologia.py::test_a_preposition_alone_is_no_offset[nl-NL-tot kerst-expected9-tot]
  • test/test_holidays_chronologia.py::test_a_preposition_alone_is_no_offset[pt-PT-at\xe9 ao natal-expected10-at\xe9 ao]

Rows from the parser-issues ledger recheck

🤖 Auto-generated by Claude Opus 5.5 (claude-opus-5-5) via Claude Code — NOT human-reviewed. Verify before acting.

These rows still read wrong on chronologia 0.35.2a1 and ovos-date-parser 0.41.0a1 from PyPI. The sections above do not list them. Each row belongs to the family named in its heading.

Reproduce with python -I in a clean venv:

from datetime import datetime
from ovos_date_parser import extract_datetime

print(extract_datetime(TEXT, LANG, anchorDate=datetime.fromisoformat(ANCHOR)))
until-range-instant: 2 rows
Lang Text Anchor Got Expected
de von montag bis 2026-03-11 10:00 2026-03-11 10:00, rem 'von' the day after "bis" (2026-03-16 Monday for "von montag bis", 2026-03-13, 2026-12-25)
de bis freitag 2026-03-11 10:00 2026-03-11 10:00, rem '' the day after "bis" (2026-03-16 Monday for "von montag bis", 2026-03-13, 2026-12-25)

Verified by command output: the Got column. Not verified by a person: the Expected column, which comes from the ledger verdicts (a ruling, arithmetic on the anchor, or a hand reading).

Dominant language
Python
Stars
0
Forks
8
Avg merge
13h 26m
Merged PRs (30d)
77

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from OpenVoiceOS/ovos-date-parser

All issues in OpenVoiceOS/ovos-date-parser

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.