{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "date-picker-with-range", "type": "registry:example", "author": "shadcn (https://ui.shadcn.com)", "dependencies": [ "date-fns" ], "registryDependencies": [ "button", "calendar", "popover" ], "files": [ { "path": "examples/date-picker-with-range.tsx", "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { addDays, format } from \"date-fns\"\nimport { Calendar as CalendarIcon } from \"lucide-react\"\nimport { DateRange } from \"react-day-picker\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button } from \"@/registry/default/ui/button\"\nimport { Calendar } from \"@/registry/default/ui/calendar\"\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"@/registry/default/ui/popover\"\n\nexport default function DatePickerWithRange({\n className,\n}: React.HTMLAttributes) {\n const [date, setDate] = React.useState({\n from: new Date(2022, 0, 20),\n to: addDays(new Date(2022, 0, 20), 20),\n })\n\n return (\n
\n \n \n \n \n {date?.from ? (\n date.to ? (\n <>\n {format(date.from, \"LLL dd, y\")} -{\" \"}\n {format(date.to, \"LLL dd, y\")}\n \n ) : (\n format(date.from, \"LLL dd, y\")\n )\n ) : (\n Pick a date\n )}\n \n \n \n \n \n \n
\n )\n}\n", "type": "registry:example", "target": "" } ] }