diff --git a/ui/components/ui/entities/date-with-time.tsx b/ui/components/ui/entities/date-with-time.tsx index 97c5fa6f6b..17600762c1 100644 --- a/ui/components/ui/entities/date-with-time.tsx +++ b/ui/components/ui/entities/date-with-time.tsx @@ -13,20 +13,31 @@ export const DateWithTime: React.FC = ({ inline = false, }) => { if (!dateTime) return --; - const date = parseISO(dateTime); - const formattedDate = format(date, "MMM dd, yyyy"); - const formattedTime = format(date, "p 'UTC'"); - return ( -
-
- {formattedDate} - {showTime && ( - {formattedTime} - )} + try { + const date = parseISO(dateTime); + + // Validate if the date is valid + if (isNaN(date.getTime())) { + return -; + } + + const formattedDate = format(date, "MMM dd, yyyy"); + const formattedTime = format(date, "p 'UTC'"); + + return ( +
+
+ {formattedDate} + {showTime && ( + {formattedTime} + )} +
-
- ); + ); + } catch (error) { + return -; + } };