Skip to content

Document region usage and stabilize current-month parsing - #1332

Merged
serhii73 merged 2 commits into
scrapinghub:masterfrom
tine1117:docs-region-supported-locales
Jun 1, 2026
Merged

serhii73 merged 2 commits into
scrapinghub:masterfrom
tine1117:docs-region-supported-locales

Conversation

@tine1117

@tine1117 tine1117 commented May 31, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Document how the region argument maps to locale subtags listed on the supported locales page, with en-IN and fr-CA examples.
  • Reuse the parser's current month when applying PREFER_MONTH_OF_YEAR="current" to incomplete dates, so current month and current day come from the same relative base.
  • Add a regression test for the month-boundary case where UTC is still May 31 but the local CI timezone is already June 1.

Fixes #465.

Test

  • python -m sphinx -b html docs docs\_build\html -q
  • python -m pytest tests/test_search.py -q
  • python -m pytest tests/test_date_parser.py -k "dates_with_no_day_or_month" -q
  • python -m ruff check dateparser/parser.py tests/test_date_parser.py
  • python -m ruff format --check dateparser/parser.py tests/test_date_parser.py

@codecov

codecov Bot commented May 31, 2026 •

Copy link
Copy Markdown

Codecov Report

βœ… All modified and coverable lines are covered by tests.
βœ… Project coverage is 97.10%. Comparing base (075712f) to head (e52d962).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1332      +/-   ##
==========================================
- Coverage   97.10%   97.10%   -0.01%     
==========================================
  Files         235      235              
  Lines        2904     2902       -2     
==========================================
- Hits         2820     2818       -2     
  Misses         84       84              

β˜” View full report in Codecov by Sentry.
πŸ“’ Have feedback on the report? Share it here.

πŸš€ New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a short explanatory note to the supported locales documentation page clarifying how the region argument relates to the locale codes listed in the table, addressing user confusion from issue #465.

Changes:

  • Documents that region accepts the region subtag from a listed locale code, with en-IN and fr-CA as examples.
  • Notes that callers who already know the full locale code can use locales=[...] directly.

πŸ’‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@tine1117 tine1117 changed the title Document region usage for supported locales Document region usage and stabilize current-month parsing May 31, 2026
@tine1117

tine1117 commented May 31, 2026 •

Copy link
Copy Markdown
Contributor Author

I looked into the failed Build run. The docs job had passed; the failure was limited to the Python 3.13 jobs running under Pacific/Auckland and Pacific/Fiji. Those jobs crossed a month boundary relative to UTC, so incomplete dates such as 2014 were using the parser's UTC day but the local CI month. That could produce an invalid intermediate date like June 31 and fall back to December 31.

I pushed a small follow-up commit to keep the current month and day on the same parser-relative base and added a regression test for that case. The new Actions runs are currently in action_required, so they need maintainer approval before they can execute.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@serhii73

serhii73 commented Jun 1, 2026

Copy link
Copy Markdown
Collaborator

Thank you!

@serhii73
serhii73 merged commit 85af00e into scrapinghub:master Jun 1, 2026
15 checks passed
@serhii73 serhii73 mentioned this pull request Jun 15, 2026
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.

No apparent way to get a list of accepted regions for use with the region argument for parse.

3 participants