
A card holding a Date Range Picker: a labelled trigger that opens a two-month range calendar in a popover, preset to a 20-day span. Uses date-fns to build the default range.
blocks/app/date-picker/index.tsx
import { addDays } from "date-fns"
import { DateRangePicker } from "@/components/forms/date-range-picker"
import { Card, CardContent } from "@/components/ui/card"
// The copy: change text here, not in the markup.
const COPY = {
label: "Pick a date",
placeholder: "Pick a date",
} as const
const START = new Date(new Date().getFullYear(), 0, 20)
export default function DatePicker({
defaultOpen = false,
}: {
defaultOpen?: boolean
}) {
return (
<Card className="mx-auto w-full max-w-md">
<CardContent>
<DateRangePicker
label={COPY.label}
placeholder={COPY.placeholder}
defaultValue={{ from: START, to: addDays(START, 20) }}
defaultOpen={defaultOpen}
/>
</CardContent>
</Card>
)
}