Wrap toISOString calls with try-catch to prevent TypeError when
date-fns-tz localToUtc returns Invalid Date in Firefox. Falls back
to the original pre-conversion date if conversion fails.
The previous fix guarded startAt/endAt numeric values but left
startDate/endDate calling .toISOString() on the potentially invalid
result of localToUtc(), which throws TypeError in Firefox when
zonedTimeToUtc returns Invalid Date. Now falls back to raw date
.toISOString() when the UTC conversion is invalid.
When date-fns-tz zonedTimeToUtc returns Invalid Date in Firefox,
the unary + operator produces NaN, which gets sent as "NaN" in
query parameters. Routes using z.coerce.number().int() validation
(events/series, event-data/properties) reject NaN as non-integer,
returning 400 errors and showing "Something went wrong".
This fix:
- Falls back to raw date timestamps when timezone conversion
produces NaN in useDateParameters
- Filters out NaN values in getQueryString to prevent invalid
parameters from reaching the server
Fixes#4121