File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 1
1
import React , { useState , useEffect } from 'react' ;
2
2
import DatePicker , { DateObject } from 'react-multi-date-picker' ;
3
+ import TextField from '@material-ui/core/TextField' ;
3
4
4
5
/* Check this sandbox
5
6
https://codesandbox.io/s/distracted-hopper-31666?file=/src/MultiDatePicker.js:373-386 */
@@ -8,7 +9,13 @@ const MultiDatePicker = ({ inputDate }) => {
8
9
const [ pickerDate , setPickerDate ] = useState ( new DateObject ( ) ) ;
9
10
10
11
const CustomComponent = ( props ) => {
11
- return < > { this . props . stringDate } </ > ;
12
+ return (
13
+ < TextField
14
+ label = "Select Date(s)"
15
+ onClick = { props . openCalendar }
16
+ value = { props . stringDate }
17
+ />
18
+ ) ;
12
19
} ;
13
20
14
21
useEffect ( ( ) => setPickerDate ( inputDate ) , [ inputDate ] ) ;
@@ -20,9 +27,10 @@ const MultiDatePicker = ({ inputDate }) => {
20
27
onChange = { setPickerDate }
21
28
multiple = { true }
22
29
style = { styles . picker }
23
- // render={<CustomComponent />}
24
- minDate = { inputDate }
25
- maxDate = { new DateObject ( inputDate ) . add ( 7 , 'days' ) }
30
+ type = "custom"
31
+ render = { < CustomComponent /> }
32
+ minDate = { new DateObject ( ) } //{inputDate}
33
+ maxDate = { new DateObject ( ) . add ( 7 , 'days' ) }
26
34
/>
27
35
) ;
28
36
} ;
You can’t perform that action at this time.
0 commit comments