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";Time zone
- 8 h09001700
- 8 h09001700
- 7 h0900120014001800
- 8 h09001700
- 8 h09001700
- Unavailable
- Unavailable
Exceptions
- Dec 24Day off
- Dec 31Custom hours09001300
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
| Prop | Type | Default | Description |
|---|---|---|---|
value / defaultValue | Availability | — | { 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. |
timezones | string[] | every zone | The zones offered. |
showTimezone / showExceptions | boolean | true | Hide the zone or the exceptions. |
step / hour12 | number / boolean | 15 / false | Minutes between the times of a list; AM and PM. |
today | string | the device's date | The date the exception picker opens on. |
disabled | boolean | — | Read only. |
className | string | — | Extra classes. |