Date Sanity Input

Date Sanity Input is a copy-paste React component that stops booked on the wrong date 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/date-sanity-input
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 2 extra npm packages
  • A11y guidance in docs

StopsBooked on the wrong date

Was this component page useful?

How do I install Date Sanity Input?

pnpm dlx shadcn@latest add @bollard/date-sanity-input

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

How do I use Date Sanity Input in React?

date-sanity-input-usage.tsx
import { DateSanityInput } from "@/components/ui/date-sanity-input"

<DateSanityInput label="Check-in" expect="future" today={TODAY} defaultValue="2062-11-08" />

What input mistakes does Date Sanity Input catch?

  • Year typos (2062 for 2026)
  • A past date where a future one is expected, or the reverse
  • Dates more than maxYearsAway from today
  • Weekends, when warnWeekends is on
  • The weekday, read back so the user can spot a wrong day

What props does Date Sanity Input accept?

DateSanityInput props
PropTypeDefault
label

Visible label.

string"Date"
hint

Helper text shown before a date is picked.

string—
value

Controlled value as `YYYY-MM-DD`, or `""`.

string—
defaultValue

Initial value when uncontrolled.

string""
onValueChange

Called with the `YYYY-MM-DD` value (or `""`).

(value: string) => void—
expect

Warn when the date is on the wrong side of today: `future` for bookings, `past` for a date of birth.

"future" | "past"—
maxYearsAway

Dates more than this many years from today are treated as a likely year typo.

number10
warnWeekends

Warn when the date falls on a Saturday or Sunday.

booleanfalse
today

"Today" as `YYYY-MM-DD`. Defaults to the user's local date once mounted.

string—
locale

Locale for the weekday and dates in messages.

string"en-IN"
messages

Override any text. Templates: `{weekday}` and `{relative}` in `readback`, `{date}` in the fix labels.

Partial<DateSanityMessages>—

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

How is Date Sanity Input accessible?

  • Visible <label>; aria-describedby to an aria-live="polite" status
  • Fix returns focus to the input
  • Motion respects prefers-reduced-motion

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

What are the limitations and server boundaries?

  • Doesn't know holidays or business-specific closed days
  • "Today" is the visitor's clock unless you pass `today`

What expensive mistakes does Date Sanity Input stop?

Booked on the wrong date

Also known as

date picker · date input · booking date · dob · date of birth · appointment · travel date · calendar

Field type

What dependencies does Date Sanity Input require?

Date Sanity Input facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameDate Sanity Input
Registry identifier@bollard/date-sanity-input
Install commandnpx shadcn@latest add @bollard/date-sanity-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, motion
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 Date Sanity Input

How does Date Sanity Input handle date and time accuracy?

Date Sanity Input catches booked on the wrong date. Validates calendar constraints: Year typos (2062 for 2026), A past date where a future one is expected, or the reverse, Dates more than maxYearsAway from today, Weekends, when warnWeekends is on, The weekday, read back so the user can spot a wrong day. Limitation: match date-sanity-input with server timezone.

How do I install date-sanity-input with shadcn?

Run `npx shadcn@latest add @bollard/date-sanity-input`. Sources added: registry/default/date-sanity-input/date-sanity-input.tsx. Package requirements: lucide-react, motion.

What props customize Date Sanity Input?

Date Sanity Input accepts `label`, `hint`, `value`, `defaultValue`, `onValueChange`. Configures date picker, date input, booking date behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of date-sanity-input?

Doesn't know holidays or business-specific closed days. "Today" is the visitor's clock unless you pass `today` Server requirement: backend verification for date-sanity-input.

How does Date Sanity Input meet accessibility guidelines?

Visible <label>; aria-describedby to an aria-live="polite" status. Fix returns focus to the input. Motion respects prefers-reduced-motion. Minimizes errors: wrong year typed date, date in the past booking.

Which components pair with Date Sanity Input?