Skip to main content

Filter by Duration

What it does: Blocks any event that runs longer than 2 hours (120 minutes), keeping only short meetings in the synced calendar.

Use case: Avoid syncing all-day workshops, multi-hour training sessions, or conference blocks that would clutter a focused calendar view.

function gate(event: GateEvent): GateResult {
if (event.durationMinutes > 120) {
return { pass: false, reason: 'Event too long (over 2 hours)' };
}
return { pass: true };
}

How It Works

The durationMinutes computed property gives the event length in minutes, calculated from start.dateTime and end.dateTime. Comparing against a threshold lets you skip events that exceed your desired meeting length. All-day events have a duration equal to the number of days multiplied by 1440 (minutes per day), so they are naturally caught by any reasonable threshold.

Customization

Block events shorter than 30 minutes (skip quick check-ins):

function gate(event: GateEvent): GateResult {
if (event.durationMinutes < 30) {
return { pass: false, reason: 'Event too short (under 30 minutes)' };
}
return { pass: true };
}

Only sync 30-minute or 60-minute meetings:

function gate(event: GateEvent): GateResult {
if (event.durationMinutes === 30 || event.durationMinutes === 60) {
return { pass: true };
}
return { pass: false, reason: 'Event is not a standard 30 or 60 minute meeting' };
}

Skip all-day events but allow long multi-hour meetings:

function gate(event: GateEvent): GateResult {
if (event.isAllDay) {
return { pass: false, reason: 'All-day event excluded' };
}
if (event.durationMinutes > 180) {
return { pass: false, reason: 'Event over 3 hours excluded' };
}
return { pass: true };
}