@@ -12,6 +12,8 @@ import '@nateradebaugh/react-datetime/scss/styles.scss'
12
12
import DurationInput from '../DurationInput'
13
13
14
14
const dateFormat = 'MM/DD/YYYY HH:mm'
15
+ const inputDateFormat = 'MM/dd/yyyy'
16
+ const inputTimeFormat = 'HH:mm'
15
17
const MAX_LENGTH = 5
16
18
17
19
const PhaseInput = ( { onUpdatePhase, phase, readOnly, phaseIndex, isActive } ) => {
@@ -25,6 +27,13 @@ const PhaseInput = ({ onUpdatePhase, phase, readOnly, phaseIndex, isActive }) =>
25
27
setEndDate ( phase . scheduledEndDate )
26
28
setDuration ( moment ( phase . scheduledEndDate ) . diff ( phase . scheduledStartDate , 'hours' ) )
27
29
}
30
+ } , [ ] )
31
+
32
+ useEffect ( ( ) => {
33
+ if ( phase ) {
34
+ setStartDate ( phase . scheduledStartDate )
35
+ setEndDate ( phase . scheduledEndDate )
36
+ }
28
37
} , [ phase ] )
29
38
30
39
useEffect ( ( ) => {
@@ -94,6 +103,8 @@ const PhaseInput = ({ onUpdatePhase, phase, readOnly, phaseIndex, isActive }) =>
94
103
return isAfter ( current , yesterday )
95
104
} }
96
105
disabled = { ! isActive }
106
+ dateFormat = { inputDateFormat }
107
+ timeFormat = { inputTimeFormat }
97
108
/> ) }
98
109
</ div >
99
110
</ div >
@@ -113,6 +124,8 @@ const PhaseInput = ({ onUpdatePhase, phase, readOnly, phaseIndex, isActive }) =>
113
124
return isAfter ( current , new Date ( startDate ) )
114
125
} }
115
126
disabled = { ! isActive }
127
+ dateFormat = { inputDateFormat }
128
+ timeFormat = { inputTimeFormat }
116
129
/> ) }
117
130
</ div >
118
131
</ div >
0 commit comments