@@ -16,10 +16,10 @@ const inputDateFormat = 'MM/dd/yyyy'
1616const inputTimeFormat = 'HH:mm'
1717const MAX_LENGTH = 5
1818
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
2121
22- const getEndDate = ( startDate , duration ) => moment ( startDate ) . add ( duration , 'hours' )
22+ const getEndDate = ( startDate , duration ) => moment ( startDate ) . add ( duration , 'hours' ) . format ( dateFormat )
2323
2424 const onStartDateChange = ( e ) => {
2525 let startDate = moment ( e ) . format ( dateFormat )
@@ -54,7 +54,7 @@ const PhaseInput = ({ onUpdatePhase, phase, readOnly, phaseIndex, isActive }) =>
5454 < span className = { styles . title } > Start Date:</ span >
5555 < div className = { styles . dayPicker } >
5656 {
57- readOnly || ! isActive ? (
57+ readOnly || ! isStartTimeActive ? (
5858 < span className = { styles . readOnlyValue } > { moment ( startDate ) . format ( dateFormat ) } </ span >
5959 )
6060 : (
@@ -88,7 +88,7 @@ const PhaseInput = ({ onUpdatePhase, phase, readOnly, phaseIndex, isActive }) =>
8888 name = { phase . name }
8989 onDurationChange = { onDurationChange }
9090 index = { phaseIndex }
91- isActive
91+ isActive = { isDurationActive || false }
9292 />
9393 ) }
9494 </ div >
@@ -100,15 +100,13 @@ const PhaseInput = ({ onUpdatePhase, phase, readOnly, phaseIndex, isActive }) =>
100100
101101PhaseInput . defaultProps = {
102102 endDate : null ,
103- readOnly : false ,
104- isActive : false
103+ readOnly : false
105104}
106105
107106PhaseInput . propTypes = {
108107 phase : PropTypes . shape ( ) . isRequired ,
109108 onUpdatePhase : PropTypes . func ,
110109 readOnly : PropTypes . bool ,
111- phaseIndex : PropTypes . number . isRequired ,
112- isActive : PropTypes . bool
110+ phaseIndex : PropTypes . number . isRequired
113111}
114112export default PhaseInput
0 commit comments