ProSchedulerSign in

Agenda · Displaying events

Time zone

The week's meetings, listed in the zone you pick. Late New York calls move to the next day in Tokyo.

Live demo

Switch between Tokyo and San Francisco

Fullscreen
import { useState } from "react"
import { ProScheduler } from "@andreisaac/pro-scheduler"
import { dataZone, globalMeetings, globalTeam } from "./data/global"
import { Choice, Toolbar, useEvents } from "./kit"

/** The zones a viewer can pick: each member's, by city. */
const zones = globalTeam.map((m) => ({ zone: m.timezone, label: m.city }))

function ZonePicker({ value, onChange }: { value: string; onChange: (zone: string) => void }) {
  return (
    <Toolbar label="Display time zone">
      {zones.map((z) => (
        <Choice key={z.zone} active={value === z.zone} onClick={() => onChange(z.zone)}>
          {z.label}
        </Choice>
      ))}
    </Toolbar>
  )
}

export function AgendaTimezoneDemo() {
  const { events, handlers } = useEvents(() => globalMeetings())
  const [zone, setZone] = useState("Asia/Tokyo")
  return (
    <>
      <ZonePicker value={zone} onChange={setZone} />
      <ProScheduler
        data={events}
        resources={globalTeam}
        dataTimezone={dataZone}
        displayTimezone={zone}
        view={{ agenda: { type: "week" } }}
        height={560}
        {...handlers}
      />
    </>
  )
}

About this demo

The week's meetings, listed in the zone you pick. Late New York calls move to the next day in Tokyo.

Things to try

  • Switch between Tokyo and San Francisco

The props behind it are explained in Recurrence, time zones and order.

Use ProScheduler in your project