diff --git a/src/components/EventDialog.vue b/src/components/EventDialog.vue
index e935f23..95b3d5a 100644
--- a/src/components/EventDialog.vue
+++ b/src/components/EventDialog.vue
@@ -531,6 +531,19 @@ const isRepeatingEdit = computed(
)
const showDeleteVariants = computed(() => isRepeatingEdit.value && occurrenceContext.value)
const isRepeatingBaseEdit = computed(() => isRepeatingEdit.value && !occurrenceContext.value)
+const isLastOccurrence = computed(() => {
+ if (!occurrenceContext.value || !editingEventId.value) return false
+ const event = calendarStore.getEventById(editingEventId.value)
+ if (!event || !event.isRepeating) return false
+
+ // For unlimited events, there is no "last" occurrence
+ if (event.repeatCount === 'unlimited' || recurrenceOccurrences.value === 0) return false
+
+ // For limited events, check if current occurrence index is the last one
+ // occurrenceIndex is 0-based, so the last occurrence has index (totalCount - 1)
+ const totalCount = parseInt(event.repeatCount, 10) || 0
+ return occurrenceContext.value.occurrenceIndex === totalCount - 1
+})
const formattedOccurrenceShort = computed(() => {
if (occurrenceContext.value?.occurrenceDate) {
try {
@@ -741,7 +754,14 @@ const recurrenceSummary = computed(() => {
-
+
diff --git a/src/stores/CalendarStore.js b/src/stores/CalendarStore.js
index a97258e..b6c4af3 100644
--- a/src/stores/CalendarStore.js
+++ b/src/stores/CalendarStore.js
@@ -417,10 +417,17 @@ export const useCalendarStore = defineStore('calendar', {
const { baseId, occurrenceIndex } = ctx
const base = this.getEventById(baseId)
if (!base || !base.isRepeating) return
- // We want to keep occurrences up to and including the selected one; that becomes new repeatCount.
- // occurrenceIndex here represents the number of repeats AFTER the base (weekly: 0 = first repeat; monthly: diffMonths)
- // Total kept occurrences = base (1) + occurrenceIndex
- const keptTotal = 1 + Math.max(0, occurrenceIndex)
+
+ // Special case: if deleting from the base occurrence (index 0), delete the entire series
+ if (occurrenceIndex === 0) {
+ this.deleteEvent(baseId)
+ return
+ }
+
+ // We want to keep occurrences up to but NOT including the selected one
+ // occurrenceIndex represents the occurrence index including the base (0=base, 1=first repeat, etc.)
+ // To exclude the current occurrence and everything after, we keep only occurrenceIndex total occurrences
+ const keptTotal = occurrenceIndex
this._terminateRepeatSeriesAtIndex(baseId, keptTotal)
},