Shift Time Input

Shift Time Input is a copy-paste React component that stops night shift logged as 20 hours before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/shift-time-input
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 3 extra npm packages
  • A11y guidance in docs

StopsNight shift logged as 20 hours

Was this component page useful?

How do I install Shift Time Input?

pnpm dlx shadcn@latest add @bollard/shift-time-input

The files land in your project. They're yours to edit.

How do I use Shift Time Input in React?

shift-time-input-usage.tsx
import { ShiftTimeInput, type ShiftValue } from "@/components/ui/shift-time-input"

<ShiftTimeInput label="Monday's shift" value={shift} onValueChange={setShift} />

What input mistakes does Shift Time Input catch?

  • Overnight shifts ending the next day
  • Ambiguous 1–12 times with no AM/PM (9–5, 10–6)
  • Zero-length, over-long (maxMinutes) and 26:00-style entries
  • A break typed in hours instead of minutes
  • Real hours when clocks change mid-shift, given date and time zone

What props does Shift Time Input accept?

ShiftTimeInput props
PropTypeDefault
label

Group label.

string"Shift"
value

Controlled value.

ShiftValue—
defaultValue

Initial value when uncontrolled.

ShiftValue{ start: "", end: "", breakMinutes: 0 }
onValueChange

Called on every change.

(value: ShiftValue) => void—
onShiftChange

Called with the worked-out shift, or null while a time can't be read.

(shift: ShiftSummary | null) => void—
maxMinutes

Longer shifts are questioned. Default 12 h.

number720
breakRule

Minimum break for long shifts; null turns it off. Default 30 min after 5 h.

BreakRule | null{ afterMinutes: 300, minBreakMinutes: 30 }
hour12

Read times back as 9:00 PM (true) or 21:00.

booleantrue
startLabel

Label of the start-time input.

string"Start"
endLabel

Label of the end-time input.

string"End"
breakLabel

Label of the break input.

string"Break (min)"
nextDayLabel

Shown after the length when the shift crosses midnight.

string"ends next day"
date

Day the shift starts, as YYYY-MM-DD. With `timeZone`, lengths count the real hours across a DST change.

string—
timeZone

IANA zone the shift is worked in, e.g. "Europe/London".

string—
dstMessages

Override the DST note (see `SHIFT_DST_MESSAGES`).

Partial<typeof SHIFT_DST_MESSAGES>—

* required. Also accepts the native props of <fieldset> (className, aria-*, data-*…), passed through to it.

How is Shift Time Input accessible?

  • Start, end and break inputs have <label>s; aria-invalid on unparseable times
  • Readback and status linked via aria-describedby and a polite live region
  • Errors use role=alert; warnings are text with icons
  • Length has an aria-label in words

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

  • Break rules and maximums are what you configure; labour law is not built in
  • DST correction needs date and timeZone props

What expensive mistakes does Shift Time Input stop?

Night shift logged as 20 hours

Also known as

shift · roster · timesheet · attendance · night shift · clock in clock out · rota · hours worked

Field type

What dependencies does Shift Time Input require?

Shift Time Input facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameShift Time Input
Registry identifier@bollard/shift-time-input
Install commandnpx shadcn@latest add @bollard/shift-time-input
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react, @date-fns/tz, @number-flow/react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about Shift Time Input

How does Shift Time Input handle date and time accuracy?

Shift Time Input catches night shift logged as 20 hours. Validates calendar constraints: Overnight shifts ending the next day, Ambiguous 1–12 times with no AM/PM (9–5, 10–6), Zero-length, over-long (maxMinutes) and 26:00-style entries, A break typed in hours instead of minutes, Real hours when clocks change mid-shift, given date and time zone. Limitation: match shift-time-input with server timezone.

How do I install shift-time-input with shadcn?

Run `npx shadcn@latest add @bollard/shift-time-input`. Sources added: registry/default/shift-time-input/shift-time-input.tsx, registry/default/shift-time-input/shift.ts. Package requirements: lucide-react, @date-fns/tz, @number-flow/react.

What props customize Shift Time Input?

Shift Time Input accepts `label`, `value`, `defaultValue`, `onValueChange`, `onShiftChange`. Configures shift, roster, timesheet behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of shift-time-input?

Break rules and maximums are what you configure; labour law is not built in. DST correction needs date and timeZone props Server requirement: backend verification for shift-time-input.

How does Shift Time Input meet accessibility guidelines?

Start, end and break inputs have <label>s; aria-invalid on unparseable times. Readback and status linked via aria-describedby and a polite live region. Errors use role=alert; warnings are text with icons. Length has an aria-label in words. Minimizes errors: overnight shift hours, shift time am pm.

Which components pair with Shift Time Input?