@@ -16,10 +16,10 @@ const inputDateFormat = 'MM/dd/yyyy'
16
16
const inputTimeFormat = 'HH:mm'
17
17
const MAX_LENGTH = 5
18
18
19
- const PhaseInput = ( { onUpdatePhase, phase, readOnly, phaseIndex, isActive } ) => {
20
- const { scheduledStartDate : startDate , scheduledEndDate : endDate , duration } = phase
19
+ const PhaseInput = ( { onUpdatePhase, phase, readOnly, phaseIndex } ) => {
20
+ const { scheduledStartDate : startDate , scheduledEndDate : endDate , duration, isStartTimeActive , isDurationActive } = phase
21
21
22
- const getEndDate = ( startDate , duration ) => moment ( startDate ) . add ( duration , 'hours' )
22
+ const getEndDate = ( startDate , duration ) => moment ( startDate ) . add ( duration , 'hours' ) . format ( dateFormat )
23
23
24
24
const onStartDateChange = ( e ) => {
25
25
let startDate = moment ( e ) . format ( dateFormat )
@@ -54,7 +54,7 @@ const PhaseInput = ({ onUpdatePhase, phase, readOnly, phaseIndex, isActive }) =>
54
54
< span className = { styles . title } > Start Date:</ span >
55
55
< div className = { styles . dayPicker } >
56
56
{
57
- readOnly || ! isActive ? (
57
+ readOnly || ! isStartTimeActive ? (
58
58
< span className = { styles . readOnlyValue } > { moment ( startDate ) . format ( dateFormat ) } </ span >
59
59
)
60
60
: (
@@ -88,7 +88,7 @@ const PhaseInput = ({ onUpdatePhase, phase, readOnly, phaseIndex, isActive }) =>
88
88
name = { phase . name }
89
89
onDurationChange = { onDurationChange }
90
90
index = { phaseIndex }
91
- isActive
91
+ isActive = { isDurationActive || false }
92
92
/>
93
93
) }
94
94
</ div >
@@ -100,15 +100,13 @@ const PhaseInput = ({ onUpdatePhase, phase, readOnly, phaseIndex, isActive }) =>
100
100
101
101
PhaseInput . defaultProps = {
102
102
endDate : null ,
103
- readOnly : false ,
104
- isActive : false
103
+ readOnly : false
105
104
}
106
105
107
106
PhaseInput . propTypes = {
108
107
phase : PropTypes . shape ( ) . isRequired ,
109
108
onUpdatePhase : PropTypes . func ,
110
109
readOnly : PropTypes . bool ,
111
- phaseIndex : PropTypes . number . isRequired ,
112
- isActive : PropTypes . bool
110
+ phaseIndex : PropTypes . number . isRequired
113
111
}
114
112
export default PhaseInput
0 commit comments