From 3a481ebb1a1a41ff481ecb55b35256943cc9b1d1 Mon Sep 17 00:00:00 2001 From: Allen Porter Date: Mon, 1 May 2023 05:48:57 -0700 Subject: [PATCH] Fix edits for single instance of all day recurring event (#16354) --- src/panels/calendar/dialog-calendar-event-editor.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/panels/calendar/dialog-calendar-event-editor.ts b/src/panels/calendar/dialog-calendar-event-editor.ts index 35660d67ae..f6980ba76d 100644 --- a/src/panels/calendar/dialog-calendar-event-editor.ts +++ b/src/panels/calendar/dialog-calendar-event-editor.ts @@ -498,12 +498,22 @@ class DialogCalendarEventEditor extends LitElement { this._submitting = false; return; } + const eventData = this._calculateData(); + if (eventData.rrule && range === RecurrenceRange.THISEVENT) { + // Updates to a single instance of a recurring event by definition + // cannot change the recurrence rule and doing so would be invalid. + // It is difficult to detect if the user changed the recurrence rule + // since updating the date may change it implicitly (e.g. day of week + // of the event changes) so we just assume the users intent based on + // recurrence range and drop any other rrule changes. + eventData.rrule = undefined; + } try { await updateCalendarEvent( this.hass!, this._calendarId!, entry.uid!, - this._calculateData(), + eventData, entry.recurrence_id || "", range! );