Scheduler · Data
Recurring events
recurring repeats an event, as an object ({ repeat: "weekly", weekDays: "TU,TH" }) or an RRULE string. recurringException leaves days out — no standup on the offsite day.
Live demo
Page through a few weeks · Find the missing standup
Fullscreenimport { ProScheduler } from "@andreisaac/pro-scheduler"
import { teamRituals, teamRooms } from "./data/rituals"
import { useEvents } from "./kit"
export function SchedulerRecurringDemo() {
const { events, handlers } = useEvents(() => teamRituals())
return (
<ProScheduler
data={events}
resources={teamRooms}
view={{ scheduler: { type: "week", startTime: "08:00", endTime: "19:00" } }}
height={620}
{...handlers}
/>
)
}// data/rituals.ts — sample data, relative to the current week or month.
import type { SchedulerEvent, SchedulerResource } from "@andreisaac/pro-scheduler"
import { weekStart } from "./studio"
export const teamRooms: SchedulerResource[] = [
{ id: "team", name: "Whole team", color: "#2563eb" },
{ id: "eng", name: "Engineering", color: "#059669" },
{ id: "design", name: "Design", color: "#d97706" },
{ id: "leads", name: "Leads", color: "#7c3aed" },
]
const at = (base: Date, day: number, hour: number, minute = 0) =>
new Date(base.getFullYear(), base.getMonth(), base.getDate() + day, hour, minute)
/** "YYYY-MM-DD" of a local day. */
const iso = (d: Date) =>
`${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`
export function teamRituals(base = weekStart()): SchedulerEvent[] {
return [
{
id: "standup",
title: "Standup",
start: at(base, 0, 9, 30),
end: at(base, 0, 9, 45),
resource: "eng",
// every weekday; skipped next Wednesday (offsite)
recurring: { repeat: "weekly", weekDays: "MO,TU,WE,TH,FR" },
recurringException: [iso(at(base, 9, 0))],
},
{
id: "design-crit",
title: "Design crit",
start: at(base, 1, 14),
end: at(base, 1, 15),
resource: "design",
recurring: "FREQ=WEEKLY;BYDAY=TU,TH",
},
{
id: "planning",
title: "Sprint planning",
start: at(base, 0, 10),
end: at(base, 0, 11, 30),
resource: "team",
recurring: { repeat: "weekly", interval: 2 },
},
{
id: "retro",
title: "Retro",
start: at(base, 11, 16),
end: at(base, 11, 17),
resource: "team",
recurring: { repeat: "weekly", interval: 2, weekDays: "FR" },
},
{
id: "one-to-ones",
title: "Leads 1:1s",
start: at(base, 2, 11),
end: at(base, 2, 12),
resource: "leads",
recurring: { repeat: "weekly", count: 12 },
},
{
id: "all-hands",
title: "All-hands",
start: at(base, 3, 17),
end: at(base, 3, 18),
resource: "team",
// the first Thursday of every month
recurring: { repeat: "monthly", weekDays: "1TH" },
},
{ id: "launch", title: "Launch review", start: at(base, 3, 13), end: at(base, 3, 14, 30), resource: "leads" },
{ id: "offsite", title: "Team offsite", start: at(base, 9, 0), end: at(base, 10, 0), allDay: true, resource: "team" },
]
}About this demo
recurring repeats an event, as an object ({ repeat: "weekly", weekDays: "TU,TH" }) or an RRULE string. recurringException leaves days out — no standup on the offsite day.
Daily, weekly, monthly (the first Thursday) and fortnightly series, all from eight events.
Things to try
- Page through a few weeks
- Find the missing standup
The props behind it are explained in Recurrence, time zones and order.