Recurring Events - Overview
Core Concepts
What is a Recurring Event?
A recurring event in Google Calendar consists of:
- Base event that defines the pattern (e.g., "Weekly Meeting every Monday at 2pm")
- Base event: has
recurrence.eventId
ANDrecurrence.rule
(e.g., "RRULE:FREQ=WEEKLY") recurrence.eventId
===gEventId
- Base event: has
- Instances: Individual occurrences that follow that pattern (e.g., individual meetings on specific Mondays)
- Instance: has
recurrence.eventId
AND NOTrecurrence.rule
- Instance: has
- Recurrence Rule: Defines how the event repeats (frequency, interval, exceptions)
- Original Start Time: The time an instance was originally scheduled for (important when instances are modified)
Think of it like a template (base event) that generates individual events (instances) based on a rule.
Event Relationships
Common Operations
Creating a Recurring Event
When a user creates a recurring event:
- Google Calendar creates a base event with a recurrence rule
- The base event serves as a template for generating instances
- Instances are generated based on the rule (e.g., weekly, daily, monthly)
Modifying Recurring Events
There are three main ways to modify a recurring event:
-
Edit One Instance
- Changes only a specific occurrence
- The instance becomes "customized" and no longer follows the base event's pattern
- Other instances remain unchanged
-
Edit This and Following
- Changes an instance and all future instances
- Creates a new series starting from the modified instance
- Original series ends before the modified instance
- Think of it like splitting a series into two parts
-
Edit All Instances
- Changes the entire series
- Creates a new series with the updated pattern
- Original series is ended
- All instances are updated to match the new pattern
Deleting Recurring Events
There are three ways to delete recurring events:
-
Delete One Instance
- Removes a single occurrence
- Other instances remain unchanged
- The instance is marked as "cancelled"
-
Delete This and Following
- Removes an instance and all future instances
- Original series ends before the deleted instance
- Similar to "Edit This and Following" but with deletion
-
Delete All Instances
- Removes the entire series
- All instances are marked as "cancelled"
- Base event is removed
Technical Details
Event Identification
Google Calendar uses specific ID patterns to identify events:
- Base events: Simple IDs (e.g.,
123
) - Instances: IDs with timestamps (e.g.,
123_20250323T120000Z
) - New base events after modifications: IDs with
_R
suffix (e.g.,123_R20250323T120000Z
)
Recurrence Rules
- Use the RRULE format (e.g.,
RRULE:FREQ=WEEKLY
) - Can include exceptions and modifications
UNTIL
rule indicates when a series ends- Rules can be complex (e.g., "every other Monday except holidays")
Relationships Between Events
- Instances link to their base event via
recurringEventId
- Modified instances keep their
originalStartTime
iCalUID
remains constant across modifications
Common Pitfalls
-
Instance Modifications
- Modified instances become independent of the base event
- They need to be tracked separately
- Original start time is crucial for identification
-
Series Splits
- When editing "this and following", you get two series
- Need to handle both the ending of the old series and creation of the new one
- Timing of the split is important
-
Deletion Handling
- Cancelled instances still exist in the API
- Need to distinguish between different types of deletions
- Series modifications can look similar to deletions
Best Practices
-
Always Track Original Times
- Keep track of original start times for instances
- Helps identify instances even after modifications
-
Handle Series Modifications Carefully
- Check for UNTIL rules to identify series endings
- Look for new base events with
_R
suffix - Preserve original series data until new series is confirmed
-
Consider Performance
- Limit instance expansion to reasonable time windows
- Batch database operations when possible
- Cache frequently accessed series data
-
Error Handling
- Validate recurrence rules
- Handle missing or malformed data gracefully
- Consider timezone implications
Common Questions
-
Why do we need both base events and instances?
- Base events define the pattern
- Instances represent actual occurrences
- Allows for individual instance modifications
-
What happens when an instance is modified?
- It becomes independent of the base event
- Original start time is preserved
- Other instances remain unchanged
-
How do we handle series splits?
- Original series ends before the split point
- New series starts from the split point
- Both series need to be managed
-
Why keep cancelled instances?
- Helps maintain history
- Allows for potential restoration
- Maintains relationships between events