Skip to main content

Business Hours Only

What it does: Blocks events that occur outside of Monday-Friday, 9 AM to 5 PM, so only business-hours meetings appear in the synced calendar.

Use case: Keep a shared availability calendar clean by excluding early-morning calls, late-night events, and weekend personal commitments.

function gate(event: GateEvent): GateResult {
if (!event.isWeekday) {
return { pass: false, reason: 'Event is on a weekend' };
}

if (event.hour < 9 || event.hour >= 17) {
return { pass: false, reason: 'Event is outside business hours' };
}

return { pass: true };
}

How It Works

Two GateEvent computed properties power this recipe:

  • isWeekdaytrue when the event starts on Monday through Friday
  • hour — the hour of day (0–23) when the event starts

Checking isWeekday first eliminates all weekend events. Then checking hour filters events that start before 9 AM or at 5 PM or later. All-day events have hour set to 0, so they will be blocked unless you add an exception.

Customization

Extend hours to 8 AM – 6 PM:

function gate(event: GateEvent): GateResult {
if (!event.isWeekday) {
return { pass: false, reason: 'Event is on a weekend' };
}

if (event.hour < 8 || event.hour >= 18) {
return { pass: false, reason: 'Event is outside extended business hours' };
}

return { pass: true };
}

Allow Saturday morning events (e.g. 9 AM – 12 PM):

function gate(event: GateEvent): GateResult {
const isSaturdayMorning = event.dayOfWeek === 6 && event.hour >= 9 && event.hour < 12;

if (!event.isWeekday && !isSaturdayMorning) {
return { pass: false, reason: 'Event outside allowed schedule' };
}

if (event.isWeekday && (event.hour < 9 || event.hour >= 17)) {
return { pass: false, reason: 'Event outside business hours' };
}

return { pass: true };
}

Always pass all-day events regardless of the day:

function gate(event: GateEvent): GateResult {
if (event.isAllDay) {
return { pass: true };
}

if (!event.isWeekday) {
return { pass: false, reason: 'Event is on a weekend' };
}

if (event.hour < 9 || event.hour >= 17) {
return { pass: false, reason: 'Event is outside business hours' };
}

return { pass: true };
}