diff --git a/clients/javascript/tests/calendarEvent.spec.ts b/clients/javascript/tests/calendarEvent.spec.ts index 6d25b212..f0379f8b 100644 --- a/clients/javascript/tests/calendarEvent.spec.ts +++ b/clients/javascript/tests/calendarEvent.spec.ts @@ -528,11 +528,13 @@ describe('CalendarEvent API', () => { const eventId = res.event.id // Test updating recurrence + const until = new Date(3000).toISOString() const res2 = await adminClient.events.update(eventId, { recurrence: { freq: 'weekly', interval: 2, count: 10, + until, }, }) @@ -544,12 +546,19 @@ describe('CalendarEvent API', () => { }) ) + expect(dayjs(res2.event.recurrence?.until)).toEqual(dayjs(until)) + // We remove 1000ms because the API always add the duration to the until, to be sure we can get overlapping instances + expect( + dayjs(res2.event.recurringUntil).subtract(1000, 'ms').toDate() + ).toEqual(dayjs(until).toDate()) + // Test setting recurrence to NULL const res3 = await adminClient.events.update(eventId, { recurrence: null, }) expect(res3.event.recurrence).toBeNull() + expect(res3.event.recurringUntil).toBeNull() }) it('should handle recurring event fields', async () => { diff --git a/crates/api/src/event/update_event.rs b/crates/api/src/event/update_event.rs index 3f84277a..cbc2e6c0 100644 --- a/crates/api/src/event/update_event.rs +++ b/crates/api/src/event/update_event.rs @@ -321,6 +321,7 @@ impl UseCase for UpdateEventUseCase { } else { // Set to NULL e.recurrence = None; + e.recurring_until = None; true } // Otherwise, we we don't have a new recurrence, but we have an existing one @@ -336,6 +337,7 @@ impl UseCase for UpdateEventUseCase { })? } else { e.recurrence = None; + e.recurring_until = None; true } } else {