You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: prevent crash when date props are passed as strings
Added safeToDate() helper function that validates date values at runtime,
returning null for invalid inputs (strings, numbers, invalid Date objects).
This allows graceful fallback instead of crashing with "getTime/getFullYear
is not a function" errors.
Fixed locations:
- time.tsx: isSelectedTime(), renderTimes() - validate selected/openToDate
- index.tsx: handleTimeOnlyArrowKey(), handleTimeOnlyInputKeyDown() - validate selected
- index.tsx: handleInputChange() - validate startDate/endDate before .getTime()
Added tests:
- 11 unit tests for safeToDate() function
- 5 integration tests for string date prop handling in TimePicker
Fixes#5964
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
0 commit comments