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 -1
View File
@@ -2,6 +2,7 @@
import { useEffect, useRef, useCallback } from 'react';
import { useTranslations, useLocale } from 'next-intl';
import { parseISO } from 'date-fns';
import { useAuthStore } from '@/stores/auth-store';
import { useCalendarStore } from '@/stores/calendar-store';
import { useSettingsStore } from '@/stores/settings-store';
@@ -50,7 +51,7 @@ export function useCalendarAlerts() {
playNotificationSound(notificationSoundChoice);
}
const diffMs = new Date(alert.event.utcStart || alert.event.start).getTime() - now;
const diffMs = (alert.event.utcStart ? new Date(alert.event.utcStart).getTime() : parseISO(alert.event.start).getTime()) - now;
const diffMin = Math.round(diffMs / 60000);
const timeLabel = diffMin <= 0