@@ -705,21 +705,26 @@ OrganisationPageViewModel = function (props, options) {
705
705
return ;
706
706
}
707
707
708
+ // The end date will be set to midnight at the start of the day because the datepicker
709
+ // isn't supplying the time. This causes issues with the display of the end date of the final
710
+ // report because the final report end date is fudged because project end dates are a day early.
711
+ // Setting a time of 23:59:59 fixes this.
712
+ var periodEnd = moment ( self . endDate ( ) ) ;
713
+ periodEnd . set ( 'hour' , 23 ) ;
714
+ periodEnd . set ( 'minute' , 59 ) ;
715
+ periodEnd . set ( 'second' , 59 ) ;
716
+ var periodEndString = periodEnd . toDate ( ) . toISOStringNoMillis ( ) ;
717
+
708
718
_ . each ( currentConfig . organisationReports , function ( reportCategory ) {
709
719
reportCategory . periodStart = self . startDate ( ) ;
710
-
711
- // The end date will be set to midnight at the start of the day because the datepicker
712
- // isn't supplying the time. This causes issues with the display of the end date of the final
713
- // report because the final report end date is fudged because project end dates are a day early.
714
- // Setting a time of 23:59:59 fixes this.
715
- var periodEnd = moment ( self . endDate ( ) ) ;
716
- periodEnd . set ( 'hour' , 23 ) ;
717
- periodEnd . set ( 'minute' , 59 ) ;
718
- periodEnd . set ( 'second' , 59 ) ;
719
-
720
- reportCategory . periodEnd = periodEnd . toDate ( ) . toISOStringNoMillis ( ) ;
720
+ reportCategory . periodEnd = periodEndString ;
721
721
} ) ;
722
722
723
+ if ( currentConfig . targets && currentConfig . targets . periodGenerationConfig ) {
724
+ currentConfig . targets . periodGenerationConfig . periodStart = self . startDate ( ) ;
725
+ currentConfig . targets . periodGenerationConfig . periodEnd = periodEndString ;
726
+ }
727
+
723
728
blockUIWithMessage ( "Saving configuration..." ) ;
724
729
self . saveConfig ( currentConfig ) . done ( function ( ) {
725
730
blockUIWithMessage ( "Configuration saved. Reloading page..." ) ;
0 commit comments