import { IconChevronDown as ChevronDown } from '@tabler/icons-react' import { t } from '@/shared/i18n' export interface BirthValue { year: string month: string day: string } export const emptyBirth: BirthValue = { year: '', month: '', day: '' } export function BirthDate({ value, onChange, error, disabled = false, helper = t('ui.birth.helper'), }: { value: BirthValue onChange: (value: BirthValue) => void error?: string disabled?: boolean helper?: string }) { const days = value.year && value.month ? new Date(Date.UTC(Number(value.year), Number(value.month), 0)).getUTCDate() : 31 const currentYear = new Date().getUTCFullYear() const options = [ Array.from({ length: currentYear - 1899 }, (_, i) => currentYear - i), Array.from({ length: 12 }, (_, i) => i + 1), Array.from({ length: days }, (_, i) => i + 1), ] const parts = ['year', 'month', 'day'] as const return (
{t('ui.birth.legend')}
{parts.map((part, index) => (
))}

{error || helper}

) }