Quiet hours

A sending-hours guard: it warns when the current local time is outside your allowed window — don't text before 8am or after 9pm — and passes an allowed flag to its children so you can disable the send button. A compliance guardrail, not a scheduler.

At 12:00 — within hours

At 02:00 — outside the window

Outside sending hours (08:00–21:00). Messaging now may reach recipients at a bad local time.

Installation

npx shadcn@latest add @handset/quiet-hours

Usage

import { QuietHours, isWithinQuietHours } from "@/components/handset/quiet-hours";

<QuietHours start="08:00" end="21:00" timezone={tenant.timezone}>
  {(allowed) => (
    <button disabled={!allowed} onClick={send}>Send</button>
  )}
</QuietHours>

It re-checks every minute so the window flips on its own. The Handset API sends immediately — there's no server-side send_at yet — so this prevents ill-timed sends rather than deferring them. The isWithinQuietHours(start, end, timezone) helper is exported if you want the check without the UI. Windows that wrap past midnight (e.g. 21:00–08:00) work too.

Props

Props
PropTypeDefaultDescription
start / endstring08:00 / 21:00Allowed window, 24h HH:MM.
timezonestring—IANA zone to evaluate in; defaults to the viewer's.
children(allowed: boolean) => ReactNode—Render-prop for your send control.
classNamestring—Merged onto the wrapper.