From 620b3a516a0ce2b6ffe155b979f0c09b8bca2497 Mon Sep 17 00:00:00 2001 From: Jeremy Clements <79224539+jeclrsg@users.noreply.github.com> Date: Wed, 23 Oct 2024 14:44:31 -0400 Subject: [PATCH] HPCC-32857 ECL Watch v9 Logs grid timestamp formatter fixes an issue with the ECL Watch v9 Logs viewer potentially having an uncaught JS exception if the logging engine is misconfigured and the value provided as the "timestamp" for a log message cannot be converted to a valid date Signed-off-by: Jeremy Clements <79224539+jeclrsg@users.noreply.github.com> --- esp/src/src-react/components/Logs.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/esp/src/src-react/components/Logs.tsx b/esp/src/src-react/components/Logs.tsx index 3fcb095bdc2..98005a65873 100644 --- a/esp/src/src-react/components/Logs.tsx +++ b/esp/src/src-react/components/Logs.tsx @@ -137,7 +137,11 @@ export const Logs: React.FunctionComponent = ({ formatter: ts => { if (ts) { if (ts.indexOf(":") < 0) { - return timestampToDate(ts).toISOString(); + const date = timestampToDate(ts); + if (!isNaN(date.getTime())) { + return date.toISOString(); + } + return ts; } return formatDateString(ts); }