diff --git a/apps/mobile/components/transaction/select-date-field.tsx b/apps/mobile/components/common/date-picker.tsx similarity index 86% rename from apps/mobile/components/transaction/select-date-field.tsx rename to apps/mobile/components/common/date-picker.tsx index 3fac88cc..fcaffb50 100644 --- a/apps/mobile/components/transaction/select-date-field.tsx +++ b/apps/mobile/components/common/date-picker.tsx @@ -13,7 +13,6 @@ import DateTimePicker from '@react-native-community/datetimepicker' import * as Haptics from 'expo-haptics' import { Calendar } from 'lucide-react-native' import { useRef, useState } from 'react' -import { useController } from 'react-hook-form' import { Keyboard, View } from 'react-native' import { useSafeAreaInsets } from 'react-native-safe-area-context' import { FullWindowOverlay } from 'react-native-screens' @@ -23,9 +22,13 @@ import { Text } from '../ui/text' function SpinnerDatePicker({ value, onChange, + maximumDate, + minimumDate, }: { value: Date onChange: (date: Date | undefined) => void + maximumDate?: Date + minimumDate?: Date }) { const { i18n } = useLingui() const [date, setDate] = useState(value) @@ -39,6 +42,8 @@ function SpinnerDatePicker({ onChange={(_, selectedDate) => { setDate(selectedDate) }} + maximumDate={maximumDate} + minimumDate={minimumDate} /> - + ( + + )} + /> {onDelete ? (