blob: f929b41df885dd8ec9d5732198a2ae0fed7bcf5c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
import moment from 'moment';
import React, {useState} from 'react';
import DatePicker from 'react-native-date-picker';
interface TaggDatePickerProps {
handleDateUpdate: (_: Date) => void;
maxDate: Date;
textColor: string;
date: Date | undefined;
}
const TaggDatePicker: React.FC<TaggDatePickerProps> = (props) => {
const [date, setDate] = useState(
props.date
? new Date(moment(props.date).add(1, 'day').format('MM-DD-YYYY'))
: undefined,
);
return (
<DatePicker
date={date ? date : props.maxDate}
textColor={props.textColor}
mode={'date'}
maximumDate={props.maxDate}
onDateChange={(newDate) => {
setDate(newDate);
props.handleDateUpdate(newDate);
}}
/>
);
};
export default TaggDatePicker;
|