ProSchedulerSign in

Timeline · Use cases

Monthly timetable

A school month at a glance: weekdays only (startDay/endDay), each day column covering just the school hours (startTime/endTime), with a row of week numbers.

Live demo

Move a lesson to another day · Page to next month

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

export function MonthlyTimetableDemo() {
  // The school's weekly lessons, repeated on every weekday of the month.
  const { events, handlers } = useEvents<SchedulerEvent>(() => {
    const now = new Date()
    const last = new Date(now.getFullYear(), now.getMonth() + 1, 0).getDate()
    const all: SchedulerEvent[] = []
    for (let day = 1; day <= last; day++) {
      const date = new Date(now.getFullYear(), now.getMonth(), day)
      if (date.getDay() === 0 || date.getDay() === 6) continue
      for (const lesson of classes(date)) all.push({ ...lesson, id: `${lesson.id}-${day}` })
    }
    return all
  })
  return (
    <ProScheduler
      data={events}
      resources={rooms}
      view={{
        timeline: {
          type: "month",
          startDay: 1,
          endDay: 5,
          startTime: "08:00",
          endTime: "17:00",
          weekNumbers: true,
        },
      }}
      styleConfig={{ unitWidthPx: 90, fitToWidth: true }}
      height={520}
      {...handlers}
    />
  )
}

About this demo

A school month at a glance: weekdays only (startDay/endDay), each day column covering just the school hours (startTime/endTime), with a row of week numbers.

Lessons sit inside their day in proportion to the hours shown.

Things to try

  • Move a lesson to another day
  • Page to next month

The props behind it are explained in Scales, ranges and zoom.

Use ProScheduler in your project