Fix Invalid Date for datetime strings from API

The API returns dates as "2024-12-11T00:00:00" (datetime, no timezone),
not bare "2024-12-11". Appending T12:00:00 directly produced an invalid
string. Use .slice(0, 10) to extract the date part first before parsing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Mistral Vibe
2026-04-06 18:40:38 +02:00
parent b09094658c
commit 013a2fc2d6
2 changed files with 3 additions and 3 deletions

View File

@@ -24,7 +24,7 @@ interface SessionDetail {
}
function formatDate(iso: string): string {
const d = new Date(iso + "T12:00:00");
const d = new Date(iso.slice(0, 10) + "T12:00:00");
return d.toLocaleDateString(undefined, { weekday: "long", year: "numeric", month: "long", day: "numeric" });
}