Blocks / Availability editor

Availability editor

Weekly hours with several ranges a day, copy to other days, dates that differ (off or custom hours) and the time zone.

import { AvailabilityEditor, defaultWeekly, spansOn, normalizeSpans } from "@forgeron/ui";
/01 → Weekly hours
Time zone
  • 8 h
    0900
    1700
  • 8 h
    0900
    1700
  • 7 h
    0900
    1200
    1400
    1800
  • 8 h
    0900
    1700
  • 8 h
    0900
    1700
  • Unavailable
  • Unavailable

Exceptions

  • Dec 24Day off
  • Dec 31Custom hours
    0900
    1300
import { AvailabilityEditor, defaultWeekly } from "@forgeron/ui";

export default function WeeklyHours() {
  return (
    <AvailabilityEditor
      today="2026-11-18"
      defaultValue={{
        timezone: "Europe/Paris",
        weekly: defaultWeekly().map((d, i) =>
          i === 2
            ? [
                { start: "09:00", end: "12:00" },
                { start: "14:00", end: "18:00" },
              ]
            : d,
        ),
        exceptions: [
          { date: "2026-12-24", kind: "off", spans: [] },
          { date: "2026-12-31", kind: "hours", spans: [{ start: "09:00", end: "13:00" }] },
        ],
      }}
    />
  );
}
API → Props
PropTypeDefaultDescription
value / defaultValueAvailability—{ timezone, weekly: TimeSpan[][] (Monday first, [] is off), exceptions: { date, kind: off | hours, spans }[] }. Controlled or not.
onChange(value: Availability) => void—On every edit. Invalid ranges are flagged, not corrected: use normalizeSpans when saving.
timezonesstring[]every zoneThe zones offered.
showTimezone / showExceptionsbooleantrueHide the zone or the exceptions.
step / hour12number / boolean15 / falseMinutes between the times of a list; AM and PM.
todaystringthe device's dateThe date the exception picker opens on.
disabledboolean—Read only.
classNamestring—Extra classes.