@@ -6,6 +6,9 @@ import moment from 'moment';
66 * @return {Date }
77 */
88export function phaseEndDate ( phase ) {
9+ if ( phase . actualEndDate ) {
10+ return new Date ( phase . actualEndDate ) ;
11+ }
912 // Case 1: phase is still open. take the `scheduledEndDate`
1013 // Case 2: phase is not open but `scheduledStartDate` is a future date.
1114 // This means phase is not yet started. So take the `scheduledEndDate`
@@ -17,7 +20,7 @@ export function phaseEndDate(phase) {
1720 return new Date ( phase . scheduledEndDate ) ;
1821 }
1922 // for other cases, take the `actualEndDate` as phase is already closed
20- return new Date ( phase . scheduledEndDate || phase . actualEndDate ) ;
23+ return new Date ( phase . actualEndDate || phase . scheduledEndDate ) ;
2124}
2225
2326/**
@@ -26,12 +29,15 @@ export function phaseEndDate(phase) {
2629 * @return {Date }
2730 */
2831export function phaseStartDate ( phase ) {
32+ if ( phase . actualStartDate ) {
33+ return new Date ( phase . actualStartDate ) ;
34+ }
2935 // Case 1: Phase is not yet started. take the `scheduledStartDate`
3036 if ( phase . isOpen !== true && moment ( phase . scheduledStartDate ) . isAfter ( ) ) {
3137 return new Date ( phase . scheduledStartDate ) ;
3238 }
3339 // For all other cases, take the `actualStartDate` as phase is already started
34- return new Date ( phase . scheduledStartDate || phase . actualStartDate ) ;
40+ return new Date ( phase . actualStartDate || phase . scheduledStartDate ) ;
3541}
3642
3743/**
0 commit comments