Add a unified event editor that works in two modes: - Calendar mode: Create/edit events directly via EventService API - Chat mode: Edit AI-proposed events before confirming them The chat mode allows users to modify proposed events (title, time, recurrence) and persists changes both locally and to the server. New components: DateTimePicker, ScrollableDropdown, useDropdownPosition New API: PUT /api/chat/messages/:messageId/proposal
30 lines
738 B
TypeScript
30 lines
738 B
TypeScript
/**
|
|
* RRULE building and parsing helpers.
|
|
*/
|
|
|
|
export type RepeatType = "Tag" | "Woche" | "Monat" | "Jahr";
|
|
|
|
const REPEAT_TYPE_TO_FREQ: Record<RepeatType, string> = {
|
|
Tag: "DAILY",
|
|
Woche: "WEEKLY",
|
|
Monat: "MONTHLY",
|
|
Jahr: "YEARLY",
|
|
};
|
|
|
|
/**
|
|
* Build an RRULE string from repeat count and type.
|
|
*
|
|
* @param repeatType - The type of repetition (Tag, Woche, Monat, Jahr)
|
|
* @param interval - The interval between repetitions (default: 1)
|
|
* @returns RRULE string like "FREQ=WEEKLY;INTERVAL=2"
|
|
*/
|
|
export function buildRRule(repeatType: RepeatType, interval: number = 1): string {
|
|
const freq = REPEAT_TYPE_TO_FREQ[repeatType];
|
|
|
|
if (interval <= 1) {
|
|
return `FREQ=${freq}`;
|
|
}
|
|
|
|
return `FREQ=${freq};INTERVAL=${interval}`;
|
|
}
|