feat: replace Date constructor with parseISO for improved date handling across calendar components #25

This commit is contained in:
Linus Rath
2026-03-26 17:42:44 +01:00
parent 9b25b6d03e
commit 733e99f094
9 changed files with 22 additions and 18 deletions
+2 -2
View File
@@ -7,7 +7,7 @@ import {
startOfMonth, endOfMonth, startOfWeek, endOfWeek,
addMonths, subMonths, addYears, subYears, setMonth, setYear,
eachDayOfInterval, getMonth, getYear, getISOWeek, getWeek,
isSameDay, isSameMonth, isToday, format,
isSameDay, isSameMonth, isToday, format, parseISO,
} from "date-fns";
import { cn } from "@/lib/utils";
import type { CalendarEvent } from "@/lib/jmap/types";
@@ -54,7 +54,7 @@ export function MiniCalendar({
const eventDates = useMemo(() => {
const set = new Set<string>();
events.forEach(e => {
try { set.add(format(new Date(e.start), "yyyy-MM-dd")); } catch { /* skip */ }
try { set.add(format(parseISO(e.start), "yyyy-MM-dd")); } catch { /* skip */ }
});
return set;
}, [events]);