Trip Date Chain

Lines up hotel nights under the flights and catches a stay booked for the wrong night, like a room from the date of a 00:50 landing.

StopsHotel booked for the wrong night

Installation

pnpm dlx shadcn@latest add https://bollard-ui.vercel.app/r/trip-date-chain.json

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

Usage

trip-date-chain-usage.tsx
import { TripDateChain, type TripLeg, type TripStay } from "@/components/ui/trip-date-chain"

return <TripDateChain legs={LEGS} defaultValue={STAYS} locale="en-GB" />

What it catches

  • Room booked from the date of a small-hours arrival (needs the night before)
  • Nights paid before a +1-day arrival
  • Gap nights with no stay
  • Overlapping stays (double-booked nights)
  • Room kept past a small-hours departure
  • Tight connections below minConnectionMinutes

Props

TripDateChain props
PropTypeDefault
legs* (required)

Flights and trains, with local times as printed.

TripLeg[]—
value

Controlled stays.

TripStay[]—
defaultValue

Initial stays when uncontrolled.

TripStay[][]
onValueChange

Called with the stays after a fix or undo.

(stays: TripStay[]) => void—
earlyHours

Times before this hour belong to the previous night (landing 00:50 needs the room from the night before). Default 6.

number6
minConnectionMinutes

With zones on both ends, a gap shorter than this between landing and the next take-off is flagged. Default 60.

number60
locale

12- or 24-hour clock follows the locale.

string—
messages

Override any visible string.

Partial<TripDateChainMessages>—

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

Accessibility

  • Visual strip is aria-hidden; every finding is also text
  • Fix and Undo are labelled buttons; outcome via role=status
  • Focus moves to the next fix after one is applied
  • Animations respect reduced motion

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

Limitations

  • Times are local wall-clock times as printed; add IANA zones for real durations
  • Reads only the legs and stays you pass
  • earlyHours defines "small hours" (configurable)

What it stops

Hotel booked for the wrong night

Also known as

itinerary · hotel booking · check-in date · check-out date · red-eye · overnight flight · +1 day arrival · travel planner

Field type

Dependencies

Pairs well with