ProSchedulerSign in

Scheduler · Configuring the view

Time zone

Meetings are stored as New York wall-clock strings (dataTimezone) and shown in the zone picked with displayTimezone — today, the current-time line and every drag follow it.

Live demo

Switch to Tokyo · Move a meeting, then switch back to New York

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 SchedulerTimezoneDemo() {
  // Stored as New York wall-clock strings; shown in the picked zone.
  const { events, handlers } = useEvents(() => globalMeetings())
  const [zone, setZone] = useState("Europe/Lisbon")
  return (
    <>
      <ZonePicker value={zone} onChange={setZone} />
      <ProScheduler
        data={events}
        resources={globalTeam}
        dataTimezone={dataZone}
        displayTimezone={zone}
        view={{ scheduler: { type: "week" } }}
        height={600}
        {...handlers}
      />
    </>
  )
}

About this demo

Meetings are stored as New York wall-clock strings (dataTimezone) and shown in the zone picked with displayTimezone — today, the current-time line and every drag follow it.

Changes come back in the data's own format: New York wall-clock strings.

Things to try

  • Switch to Tokyo
  • Move a meeting, then switch back to New York

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

Use ProScheduler in your project