Skip to content

Fix: Prevent Dashboard Crash from Unsafe Date Parsing - #225

Merged
khanirfan18 merged 1 commit into
khanirfan18:mainfrom
TanCodeX:fix/unsafe-date-parsing-dashboard
Jul 9, 2026
Merged

Fix: Prevent Dashboard Crash from Unsafe Date Parsing#225
khanirfan18 merged 1 commit into
khanirfan18:mainfrom
TanCodeX:fix/unsafe-date-parsing-dashboard

Conversation

@TanCodeX

Copy link
Copy Markdown
Contributor

Summary

Closes #224

This PR improves the stability of src/pages/Dashboard.jsx by adding safe handling for transaction date parsing. It prevents runtime crashes caused by invalid or improperly formatted date strings.

Previously, the getMonth helper assumed all transaction dates were valid, which could lead to a RangeError when format() is called on an invalid date.


Changes Made

  • Added validation for parsed dates in getMonth helper

  • Ensured invalid, empty, or undefined dateStr values are safely handled

  • Prevented format() from being called on invalid Date objects

  • Added fallback behavior for corrupted or malformed transaction dates

    • Invalid entries are skipped or safely ignored in grouping logic

Why This Matters

  • Prevents full Dashboard crashes (white screen of death)
  • Improves resilience against bad or inconsistent data
  • Makes date handling robust across all transaction inputs
  • Ensures UI remains stable even when data is partially corrupted

Behavior Change

  • Before: Invalid date → app crash ❌
  • Now: Invalid date → safely ignored / handled gracefully ✅

Testing

  • Pass valid date strings → months render correctly
  • Pass empty/null/invalid dates → Dashboard does not crash
  • Mix valid + invalid data → only valid entries are processed

Impact

  • Improved application stability
  • Safer data processing in Dashboard
  • Better user experience with corrupted or incomplete data

@netlify

netlify Bot commented Jun 21, 2026

Copy link
Copy Markdown

👷 Deploy request for finnboard0 pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit d5ea0a6

@netlify

netlify Bot commented Jun 21, 2026

Copy link
Copy Markdown

Deploy Preview for finnboard ready!

Name Link
🔨 Latest commit d5ea0a6
🔍 Latest deploy log https://app.netlify.com/projects/finnboard/deploys/6a37cca01ec37200082c5b92
😎 Deploy Preview https://deploy-preview-225--finnboard.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@TanCodeX

Copy link
Copy Markdown
Contributor Author

@khanirfan18 Please review!!

@TanCodeX

TanCodeX commented Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

@khanirfan18 review!

@khanirfan18
khanirfan18 merged commit dc55718 into khanirfan18:main Jul 9, 2026
4 checks passed
@TanCodeX

TanCodeX commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

@khanirfan18 level?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Unsafe Date Parsing Causes Potential Dashboard Crash

2 participants