'use client'; import { format, parseISO } from 'date-fns'; import { ru } from 'date-fns/locale'; import { CalendarIcon } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Calendar } from '@/components/ui/calendar'; import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'; import { cn } from '@/lib/utils'; export function DatePicker({ value, onChange, placeholder = 'Дата рождения', className, disabled }: { value?: string; onChange: (value: string | undefined) => void; placeholder?: string; className?: string; disabled?: boolean; }) { const selected = value ? parseISO(value) : undefined; return ( onChange(date ? format(date, 'yyyy-MM-dd') : undefined)} disabled={(date) => date > new Date()} defaultMonth={selected ?? new Date(1990, 0, 1)} captionLayout="dropdown" hideNavigation startMonth={new Date(1920, 0)} endMonth={new Date()} /> ); }