Skip to content

Commit 36cab80

Browse files
author
vikasrohit
authored
Merge pull request #3190 from appirio-tech/hotfix/post-release-2.4.13.2
Github issue#3189, Unable to activate a phase without explicitly setting start date to today's date
2 parents f7bfa86 + aaa8fda commit 36cab80

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/projects/actions/project.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,9 @@ export function updatePhase(projectId, phaseId, updatedProps, phaseIndex) {
342342
const startDateChanged = updatedProps.startDate ? updatedProps.startDate.diff(phaseStartDate) : null
343343
const phaseActivated = phaseStatusChanged && updatedProps.status === PHASE_STATUS_ACTIVE
344344
if (phaseActivated) {
345-
updatedProps.startDate = moment().hours(0).minutes(0).seconds(0).milliseconds(0)
345+
const duration = updatedProps.duration ? updatedProps.duration : phase.duration
346+
updatedProps.startDate = moment().utc().hours(0).minutes(0).seconds(0).milliseconds(0).format('YYYY-MM-DD')
347+
updatedProps.endDate = moment(updatedProps.startDate).add(duration - 1, 'days').format('YYYY-MM-DD')
346348
}
347349

348350
return dispatch({
@@ -386,7 +388,7 @@ export function updatePhase(projectId, phaseId, updatedProps, phaseIndex) {
386388
timeline.id,
387389
{
388390
name: timeline.name,
389-
startDate: updatedProps.startDate.format('YYYY-MM-DD'),
391+
startDate: updatedProps.startDate,
390392
reference: timeline.reference,
391393
referenceId: timeline.referenceId,
392394
}

0 commit comments

Comments
 (0)