Skip to content

fix: validate inverted reporting date range on contributor profile - #175

Open
aryanorastar wants to merge 1 commit into
AOSSIE-Org:mainfrom
aryanorastar:fix/174-invalid-reporting-date-range
Open

fix: validate inverted reporting date range on contributor profile#175
aryanorastar wants to merge 1 commit into
AOSSIE-Org:mainfrom
aryanorastar:fix/174-invalid-reporting-date-range

Conversation

@aryanorastar

@aryanorastar aryanorastar commented Aug 16, 2026

Copy link
Copy Markdown

Summary

Fixes #174

On the Contributor Profile reporting window, choosing a start date after the end date previously filtered contributions to zero with no validation message — easy to misread as “no activity.”

This change:

  • Detects inverted YYYY-MM-DD ranges
  • Shows: Invalid date range: Start date cannot be later than end date.
  • Avoids presenting that state as a real empty period (metrics show , table empty copy uses the same validation message)
  • Adds min/max hints on the date inputs

Verification

  • npm test -- --run — 44/44 passed (includes new reportingDateRange unit tests)
  • Logic check: 2026-08-20 / 2026-08-10 → invalid; equal or ordered dates → valid

Honest gaps

  • Did not click through a live Contributor Profile against the GitHub Search API in a browser (no org session / PAT in this environment)

Summary by CodeRabbit

  • Bug Fixes

    • Added validation for reversed reporting date ranges.
    • Invalid ranges now clear contribution results, disable report exports, constrain date inputs, and display an alert.
    • Contribution metrics show placeholders when the selected range is invalid.
    • PR and issue tables display a clear invalid-range message.
  • Tests

    • Added coverage for open-ended, valid, and invalid reporting periods.

Show a clear error when start date is after end date instead of
treating the inverted window as an empty contribution period.
@github-actions github-actions Bot added bug Something isn't working frontend Frontend changes javascript JavaScript/TypeScript changes tests Test changes labels Aug 16, 2026
@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 1ef964f0-eee2-4261-8b34-c5bddad3c834

📥 Commits

Reviewing files that changed from the base of the PR and between 2098d23 and 5288cbd.

📒 Files selected for processing (3)
  • src/pages/ContributorProfilePage.jsx
  • src/utils/reportingDateRange.js
  • src/utils/reportingDateRange.test.js

Included review availability: Your plan includes up to 1 review per rolling hour; 0 remain after this review.


Walkthrough

The contributor profile now validates reporting date ranges. Reversed ranges clear filtered contributions, disable export, constrain date inputs, show an alert, use placeholder metrics, and display a shared message in pull-request and issue tables.

Changes

Contributor reporting validation

Layer / File(s) Summary
Date-range validation contract
src/utils/reportingDateRange.js, src/utils/reportingDateRange.test.js
The utility detects reversed ISO date ranges, exports the shared invalid-range message, and includes coverage for open-ended, valid, and invalid ranges.
Contributor invalid-range handling
src/pages/ContributorProfilePage.jsx
The profile validates selected dates, prevents filtering and export for invalid ranges, constrains date inputs, shows corrective feedback and placeholder metrics, and passes the shared message to both tables.

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

Merge Risk: ⚪ Minimal · up to 5288c

This PR adds validation for inverted contributor reporting date ranges and prevents them from appearing as real empty periods. No actionable merge-blocking risk remains beyond normal checks and review.

Possibly related PRs

Suggested labels: Typescript Lang

Poem

I’m a rabbit with dates in a row,
I flag when the start jumps too far so.
Empty tables speak clearly,
Metrics show placeholders sincerely,
And exports wait till valid bounds grow.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes implement issue #174 by detecting inverted ranges, showing the required message, preventing valid-period metrics, and adding tests.
Out of Scope Changes check ✅ Passed The changes remain within the scope of issue #174 and support reporting date-range validation on the Contributor Profile.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: validating inverted reporting date ranges on the Contributor Profile.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@github-actions github-actions Bot added size/M 51-200 lines changed first-time-contributor First time contributor and removed size/M 51-200 lines changed labels Aug 16, 2026
@github-actions github-actions Bot added size/M 51-200 lines changed and removed size/M 51-200 lines changed labels Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working first-time-contributor First time contributor frontend Frontend changes javascript JavaScript/TypeScript changes size/M 51-200 lines changed tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: Add validation for invalid date ranges in Contributor Profile

1 participant