Skip to content

Preserve explicit DATE_ORDER when searching multiple dates - #1515

Closed
FanWu-ai wants to merge 1 commit into
scrapinghub:masterfrom
FanWu-ai:fix/preserve-search-date-order
Closed

FanWu-ai wants to merge 1 commit into
scrapinghub:masterfrom
FanWu-ai:fix/preserve-search-date-order

Conversation

@FanWu-ai

@FanWu-ai FanWu-ai commented Oct 2, 2026

Copy link
Copy Markdown

Resolves #1512.

Summary

When search_dates derives RELATIVE_BASE from a previous match, Settings.replace() drops the record of settings explicitly supplied by the caller. The next date can then use the English locale's date order instead of the requested DATE_ORDER.

Preserve _mod_settings while replacing RELATIVE_BASE. Add a regression test using the Dutch input from #1512: with DATE_ORDER="DMY" and STRICT_PARSING=True, the second match, 01-11-2026, must remain November 1 rather than January 11.

This is the separate search-settings bug noted in #1443; it does not add a new date-order setting.

Validation

Tested on Python 3.12:

  • The new regression test fails before the fix and passes after it.
  • pytest tests/test_search.py: 291 passed.
  • Default test suite: 24,467 passed, 8 skipped, 1 xfailed, 36 subtests passed.
  • tox -e pre-commit: ruff check, ruff format, and zizmor passed.
  • git diff --check: passed.

The full multi-environment tox matrix was not run. Optional calendar/language-detection dependencies were not installed; the reported skips are retained.

@FanWu-ai
FanWu-ai marked this pull request as ready for review October 2, 2026 10:26
@github-actions github-actions Bot added the spam label Oct 2, 2026
@github-actions github-actions Bot closed this Oct 2, 2026
@FanWu-ai
FanWu-ai deleted the fix/preserve-search-date-order branch October 13, 2026 05:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1.4.3 regression: search_dates ignores explicit DATE_ORDER for every date after the first

1 participant