Background
The helpers in `src/utils/dateUtils.ts` (`formatDate`, `formatShortDate`, `formatTime`) pass `new Date(date)` straight into `Intl.DateTimeFormat.format`, which throws `RangeError: Invalid time value` when the input is an unparseable string/number, and `formatRelative` produces nonsensical output for the same. There is also no test file for this module. Add an invalid-date guard that returns a safe fallback (e.g. an empty string or a passed-in placeholder) and add unit tests.
Files to modify (2)
- src/utils/dateUtils.ts
- src/utils/tests/dateUtils.test.ts
Acceptance Criteria
Background
The helpers in `src/utils/dateUtils.ts` (`formatDate`, `formatShortDate`, `formatTime`) pass `new Date(date)` straight into `Intl.DateTimeFormat.format`, which throws `RangeError: Invalid time value` when the input is an unparseable string/number, and `formatRelative` produces nonsensical output for the same. There is also no test file for this module. Add an invalid-date guard that returns a safe fallback (e.g. an empty string or a passed-in placeholder) and add unit tests.
Files to modify (2)
Acceptance Criteria