feat: add timezone-aware formatting for event start times and update utcEnd on duration change

This commit is contained in:
Linus Rath
2026-04-22 21:05:41 +02:00
parent 27f4fbdce4
commit cab57f6cd7
3 changed files with 35 additions and 2 deletions
+9
View File
@@ -4,6 +4,7 @@ import type { IJMAPClient } from '@/lib/jmap/client-interface';
import type { Calendar, CalendarEvent, CalendarParticipant } from '@/lib/jmap/types';
import { debug } from '@/lib/debug';
import { normalizeAllDayDuration } from '@/lib/calendar-utils';
import { parseDuration } from '@/components/calendar/event-card';
import { sanitizeOutgoingCalendarEventData } from '@/lib/calendar-event-normalization';
import { expandRecurringEvents } from '@/lib/recurrence-expansion';
import { generateUUID } from '@/lib/utils';
@@ -347,6 +348,14 @@ export const useCalendarStore = create<CalendarStore>()(
}
}
}
// When duration changes (e.g. resize), recompute utcEnd so the event
// renders with the new length immediately without waiting for refresh.
if (cleanUpdates.duration !== undefined && merged.utcStart) {
const durationMinutes = parseDuration(cleanUpdates.duration);
merged.utcEnd = new Date(
new Date(merged.utcStart).getTime() + durationMinutes * 60000,
).toISOString();
}
return merged;
}),
}));