ProSchedulerSign in

Scheduler · Data

Date formats

start and end accept Date objects, ISO strings with or without an offset, and epoch milliseconds — whatever your API returns.

Live demo

Compare each input with where it lands

Fullscreen
import { ProScheduler, type SchedulerEvent } from "@andreisaac/pro-scheduler"
import { weekStart } from "./data/studio"
import { useEvents } from "./kit"

export function DateFormatsDemo() {
  const monday = weekStart()
  const day = (n: number, hour: number, minute = 0) =>
    new Date(monday.getFullYear(), monday.getMonth(), monday.getDate() + n, hour, minute)
  // "2026-09-30T10:00" — local wall-clock time, no offset
  const localIso = (d: Date) =>
    new Date(d.getTime() - d.getTimezoneOffset() * 60_000).toISOString().slice(0, 16)

  const { events, handlers } = useEvents<SchedulerEvent>([
    { id: "a", title: "Date object", start: day(0, 9), end: day(0, 11) },
    { id: "b", title: "ISO string, local time", start: localIso(day(1, 10)), end: localIso(day(1, 12, 30)) },
    { id: "c", title: "ISO string in UTC", start: day(2, 12).toISOString(), end: day(2, 13).toISOString() },
    { id: "d", title: "Epoch milliseconds", start: day(3, 14).getTime(), end: day(3, 16).getTime() },
  ])

  return (
    <div className="docs-demo__stack">
      <ul className="demo-inputs">
        {events.map((e) => (
          <li key={e.id}>
            <strong>{e.title}</strong> <code>{JSON.stringify(e.start)}</code>
          </li>
        ))}
      </ul>
      <ProScheduler
        data={events}
        view={{ scheduler: { type: "week", startTime: "07:00", endTime: "19:00" } }}
        height={520}
        {...handlers}
      />
    </div>
  )
}

About this demo

start and end accept Date objects, ISO strings with or without an offset, and epoch milliseconds — whatever your API returns.

Things to try

  • Compare each input with where it lands

The props behind it are explained in Loading and saving events.

Use ProScheduler in your project