Scheduler · Configuring the view
Multiple time zones
timezones adds a time column per zone beside the gutter, so the same row reads in San Francisco, New York, Tokyo and Lisbon.
Live demo
Find a slot inside everyone's working day
Fullscreenimport { ProScheduler } from "@andreisaac/pro-scheduler"
import { dataZone, globalMeetings, globalTeam } from "./data/global"
import { useEvents } from "./kit"
export function MultipleTimezonesDemo() {
const { events, handlers } = useEvents(() => globalMeetings())
return (
<ProScheduler
data={events}
resources={globalTeam}
dataTimezone={dataZone}
displayTimezone="Europe/Lisbon"
view={{
scheduler: {
type: "week",
timezones: [
{ timezone: "America/Los_Angeles", label: "SF" },
{ timezone: "America/New_York", label: "NY" },
{ timezone: "Asia/Tokyo", label: "Tokyo" },
],
},
}}
styleConfig={{ timeGutterWidth: 56 }}
height={620}
{...handlers}
/>
)
}// data/global.ts — sample data, relative to the current week or month.
import type { SchedulerEvent, SchedulerResource } from "@andreisaac/pro-scheduler"
import { weekStart } from "./studio"
export type Member = SchedulerResource & { id: string; timezone: string; city: string }
export const globalTeam: Member[] = [
{ id: "maya", name: "Maya", city: "San Francisco", timezone: "America/Los_Angeles", color: "#2563eb" },
{ id: "leo", name: "Leo", city: "New York", timezone: "America/New_York", color: "#059669" },
{ id: "ines", name: "Inês", city: "Lisbon", timezone: "Europe/Lisbon", color: "#d97706" },
{ id: "arjun", name: "Arjun", city: "Bengaluru", timezone: "Asia/Kolkata", color: "#7c3aed" },
{ id: "yuki", name: "Yuki", city: "Tokyo", timezone: "Asia/Tokyo", color: "#db2777" },
]
export const dataZone = "America/New_York"
/** "YYYY-MM-DDTHH:MM" for day `day` of this week, at New York time `hour:minute`. */
function ny(base: Date, day: number, hour: number, minute = 0) {
const d = new Date(base.getFullYear(), base.getMonth(), base.getDate() + day)
const p = (n: number) => String(n).padStart(2, "0")
return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())}T${p(hour)}:${p(minute)}`
}
export function globalMeetings(base = weekStart()): SchedulerEvent[] {
return [
{ id: "sync", title: "Global sync", start: ny(base, 0, 8), end: ny(base, 0, 9), resource: ["maya", "leo", "ines", "arjun"], recurring: "FREQ=WEEKLY;BYDAY=MO,TH" },
{ id: "design", title: "Design review", start: ny(base, 1, 11), end: ny(base, 1, 12), resource: ["maya", "leo", "ines"] },
{ id: "apac", title: "APAC handover", start: ny(base, 1, 20), end: ny(base, 1, 20, 30), resource: ["leo", "arjun", "yuki"], recurring: { repeat: "weekly", weekDays: "TU,WE,TH" } },
{ id: "infra", title: "Infra on-call", start: ny(base, 2, 3), end: ny(base, 2, 5), resource: ["arjun", "yuki"] },
{ id: "customer", title: "Customer call", start: ny(base, 3, 13), end: ny(base, 3, 14), resource: ["leo", "maya"] },
{ id: "planning", title: "Quarterly planning", start: ny(base, 4, 9), end: ny(base, 4, 11), resource: ["maya", "leo", "ines", "arjun", "yuki"] },
]
}About this demo
timezones adds a time column per zone beside the gutter, so the same row reads in San Francisco, New York, Tokyo and Lisbon.
Things to try
- Find a slot inside everyone's working day
The props behind it are explained in Recurrence, time zones and order.