Skip to content

Add LocalDateRange.withEndInclusive(TemporalAdjuster) - #383

Merged
jodastephen merged 1 commit into
mainfrom
local-date-range2
Jul 30, 2026
Merged

Add LocalDateRange.withEndInclusive(TemporalAdjuster)#383
jodastephen merged 1 commit into
mainfrom
local-date-range2

Conversation

@jodastephen

@jodastephen jodastephen commented Jul 30, 2026

Copy link
Copy Markdown
Member

Allows a range to be adjusted based on the inclusive end date.

Fixes #371

Summary by CodeRabbit

  • New Features
    • Added support for adjusting a date range’s inclusive end date with a temporal adjuster.
  • Documentation
    • Clarified date range behavior for empty ranges, zero-length periods, and exclusive versus inclusive end dates.
    • Updated validation messaging for invalid periods.
  • Bug Fixes
    • Improved handling and validation of empty or invalid closed date ranges.
  • Tests
    • Added coverage for inclusive-end adjustments, boundary dates, and invalid range scenarios.

Copilot AI review requested due to automatic review settings July 30, 2026 21:26
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7ecde43d-d4cd-4560-b2ae-0b84b77010f7

📥 Commits

Reviewing files that changed from the base of the PR and between b89910c and 57fab26.

📒 Files selected for processing (3)
  • src/changes/changes.xml
  • src/main/java/org/threeten/extra/LocalDateRange.java
  • src/test/java/org/threeten/extra/TestLocalDateRange.java

📝 Walkthrough

Walkthrough

LocalDateRange now provides withEndInclusive(TemporalAdjuster), clarifies range and period validation semantics, adds coverage for valid and invalid cases, and documents the API in the 1.11.0 release notes.

Changes

LocalDateRange inclusive-end adjustment

Layer / File(s) Summary
Range API and validation semantics
src/main/java/org/threeten/extra/LocalDateRange.java
Clarifies empty-range and zero-period rules, distinguishes exclusive-end adjustment, and adds withEndInclusive based on the adjusted inclusive endpoint.
Behavior validation and release documentation
src/test/java/org/threeten/extra/TestLocalDateRange.java, src/changes/changes.xml
Tests valid, boundary, empty, and invalid cases, and records the new API in the 1.11.0 release notes.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant LocalDateRange
  participant TemporalAdjuster
  Caller->>LocalDateRange: withEndInclusive(adjuster)
  LocalDateRange->>LocalDateRange: getEndInclusive()
  LocalDateRange->>TemporalAdjuster: adjust inclusive end date
  TemporalAdjuster-->>LocalDateRange: adjusted end date
  LocalDateRange->>LocalDateRange: ofClosed(start, adjusted end)
  LocalDateRange-->>Caller: new LocalDateRange
Loading
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR adds withEndInclusive and doc/test updates, but issue #371 asked for factory methods from Year/YearMonth/YearQuarter/YearWeek. Implement the requested LocalDateRange factory methods, or update the issue scope, so the PR matches #371.
Out of Scope Changes check ⚠️ Warning These changes add a withEndInclusive API and related docs/tests, which are unrelated to the linked factory-method request. Either add the factory methods requested by #371 or move this API change to a separate PR.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly names the main change: adding LocalDateRange.withEndInclusive(TemporalAdjuster).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch local-date-range2

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR adds an API to adjust LocalDateRange based on its inclusive end date, extending the range-manipulation capabilities alongside existing withStart(...) and withEnd(...) adjuster methods.

Changes:

  • Add LocalDateRange.withEndInclusive(TemporalAdjuster) and associated tests.
  • Add validation test coverage for LocalDateRange.ofClosed(...) rejecting end-before-start.
  • Update changelog and refine related Javadoc.

Reviewed changes

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

File Description
src/main/java/org/threeten/extra/LocalDateRange.java Adds withEndInclusive(TemporalAdjuster) and updates/clarifies Javadocs.
src/test/java/org/threeten/extra/TestLocalDateRange.java Adds unit tests for withEndInclusive(...) and for invalid ofClosed(...) inputs.
src/changes/changes.xml Records the new API in the 1.11.0 changelog.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main/java/org/threeten/extra/LocalDateRange.java Outdated
Comment thread src/main/java/org/threeten/extra/LocalDateRange.java
Comment thread src/changes/changes.xml
Allows a range to be adjusted based on the inclusive end date.

Fixes #371
@jodastephen

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@jodastephen
jodastephen merged commit 56445ea into main Jul 30, 2026
9 checks passed
@jodastephen
jodastephen deleted the local-date-range2 branch July 30, 2026 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Add some factory methods for LocalDateRange

2 participants