← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12779: Fixed minor bug with javascript period type library related to which periods to include in year

 

------------------------------------------------------------
revno: 12779
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-10-21 16:11:17 +0200
message:
  Fixed minor bug with javascript period type library related to which periods to include in year
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/periodType.js


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/periodType.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/periodType.js	2012-11-20 17:44:12 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/periodType.js	2013-10-21 14:11:17 +0000
@@ -106,7 +106,7 @@
         var day = startDate.date().getDay();
         var i = 0;
 
-        if ( day == 0 ) // Sunday, forward to Monday
+        if ( day == 0 ) // Sunday (0), forward to Monday
         {
             startDate.adjust( 'D', +1 );
         }
@@ -122,7 +122,9 @@
         
         var endDate = startDate.clone().adjust( 'D', +6 );
 
-        while ( startDate.date().getFullYear() <= year )
+        // Include all weeks where Thursday falls in same year
+        
+        while ( startDate.clone().adjust( 'D', 3 ).date().getFullYear() <= year )
         {
             var period = [];
             period['startDate'] = startDate.format( dateFormat );