From 45afe23521af3dcc8d07cdf285f123f10a61a1ce 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..48c890c344b 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 (date.toString() !== "Invalid Date") { + return date.toISOString(); + } + return ts; } return formatDateString(ts); }