Skip to content

fix: validate date value in FilterChip to prevent RangeError#656

Merged
rsbh merged 1 commit intomainfrom
fix_invalid_date_filter_chip
Feb 26, 2026
Merged

fix: validate date value in FilterChip to prevent RangeError#656
rsbh merged 1 commit intomainfrom
fix_invalid_date_filter_chip

Conversation

@rsbh
Copy link
Member

@rsbh rsbh commented Feb 26, 2026

Summary

  • Add dayjs.isValid() check before calling toISOString() in handleStringBasedTypes to prevent RangeError: Invalid time value when an invalid date is entered
  • Hide error helper text inside FilterChip date picker to prevent layout overflow
  • Show red border on invalid date input for visual feedback

Before

Screenshot 2026-02-26 at 11 10 44 AM

After

Screenshot 2026-02-26 at 11 09 45 AM

Test plan

  • Open a DataTable with a date filter column
  • Click the date filter chip and type an invalid date (e.g. 04/02/2026)
  • Verify no RangeError is thrown
  • Verify the input shows a red border for invalid dates
  • Verify valid dates still work correctly

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved date filter validation to properly handle invalid date entries and prevent conversion errors.
    • Enhanced error messaging display for date fields with clearer visual indicators for validation failures.

…id input

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Feb 26, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
apsara Building Building Preview, Comment Feb 26, 2026 5:41am

@rsbh rsbh requested review from paanSinghCoder and rohanchkrabrty and removed request for paanSinghCoder February 26, 2026 05:41
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9cbeb6f and f6ab731.

📒 Files selected for processing (2)
  • packages/raystack/components/data-table/utils/filter-operations.tsx
  • packages/raystack/components/filter-chip/filter-chip.module.css

📝 Walkthrough

Walkthrough

This PR enhances date filtering validation by checking date validity before converting to ISO string format, and adds CSS error state styling to date filter chips for improved user feedback on invalid input.

Changes

Cohort / File(s) Summary
Date Filter Logic Validation
packages/raystack/components/data-table/utils/filter-operations.tsx
Modified handleStringBasedTypes for FilterType.date to validate dates using dayjs before ISO conversion; sets stringValue to empty string if date is invalid, preventing malformed date strings.
Filter Chip Error Styling
packages/raystack/components/filter-chip/filter-chip.module.css
Added CSS rules to hide helper-text and apply danger border styling to the input-error-wrapper within dateFieldWrapper for visual error indication.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰✨ A hop through dates so fine,
Where validation makes them shine,
No more broken ISO strings,
Error borders mark all things,
Date fields dance in perfect form! 🗓️

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately reflects the main change: adding date validation to prevent RangeError in FilterChip, which matches the primary fix described in the objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix_invalid_date_filter_chip

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 and usage tips.

@rsbh rsbh merged commit 6d102a3 into main Feb 26, 2026
5 checks passed
@rsbh rsbh deleted the fix_invalid_date_filter_chip branch February 26, 2026 05:45
rsbh added a commit that referenced this pull request Feb 26, 2026
fix: validate date value in FilterChip to prevent RangeError on invalid input

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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.

3 participants