fix: fixed bug when opening finding details while a scan is in progress (#6708)

This commit is contained in:
Pablo Lara
2025-01-28 06:58:18 +01:00
committed by GitHub
parent ddd83b340e
commit 45d44a1669
+25 -14
View File
@@ -13,20 +13,31 @@ export const DateWithTime: React.FC<DateWithTimeProps> = ({
inline = false,
}) => {
if (!dateTime) return <span>--</span>;
const date = parseISO(dateTime);
const formattedDate = format(date, "MMM dd, yyyy");
const formattedTime = format(date, "p 'UTC'");
return (
<div className="mw-fit py-[2px]">
<div
className={`flex ${inline ? "flex-row items-center gap-2" : "flex-col"}`}
>
<span className="text-xs font-semibold">{formattedDate}</span>
{showTime && (
<span className="text-tiny text-gray-500">{formattedTime}</span>
)}
try {
const date = parseISO(dateTime);
// Validate if the date is valid
if (isNaN(date.getTime())) {
return <span>-</span>;
}
const formattedDate = format(date, "MMM dd, yyyy");
const formattedTime = format(date, "p 'UTC'");
return (
<div className="mw-fit py-[2px]">
<div
className={`flex ${inline ? "flex-row items-center gap-2" : "flex-col"}`}
>
<span className="text-xs font-semibold">{formattedDate}</span>
{showTime && (
<span className="text-tiny text-gray-500">{formattedTime}</span>
)}
</div>
</div>
</div>
);
);
} catch (error) {
return <span>-</span>;
}
};