From 6438fcb12f49b321c55d79625f335968fe5e3cd3 Mon Sep 17 00:00:00 2001 From: Francisco Pessano <76450203+FranP-code@users.noreply.github.com> Date: Sun, 13 Jul 2025 21:03:15 -0300 Subject: [PATCH] Fix invalid time value error in date formatting --- astro-app/src/components/ProjectCard.tsx | 4 +++- astro-app/src/components/ProjectsTable.tsx | 4 +++- astro-app/src/lib/csv-loader.ts | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/astro-app/src/components/ProjectCard.tsx b/astro-app/src/components/ProjectCard.tsx index dd1416c..db68a6d 100644 --- a/astro-app/src/components/ProjectCard.tsx +++ b/astro-app/src/components/ProjectCard.tsx @@ -11,7 +11,9 @@ interface ProjectCardProps { } export function ProjectCard({ project, onSeenStatusChange }: ProjectCardProps) { - const formattedDate = formatDistanceToNow(new Date(project.created_at), { addSuffix: true }); + const formattedDate = project.created_at && !isNaN(new Date(project.created_at).getTime()) + ? formatDistanceToNow(new Date(project.created_at), { addSuffix: true }) + : 'N/A'; const [seen, setSeen] = useState(false); useEffect(() => { diff --git a/astro-app/src/components/ProjectsTable.tsx b/astro-app/src/components/ProjectsTable.tsx index 3a624f4..80aa32d 100644 --- a/astro-app/src/components/ProjectsTable.tsx +++ b/astro-app/src/components/ProjectsTable.tsx @@ -205,7 +205,9 @@ export function ProjectsTable({ projects, title, showUrlColumn = true, onSeenSta ), cell: ({ row }) => (