← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17588: bugfix for dhis2.period.js bi-monthly generator

 

------------------------------------------------------------
revno: 17588
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-11-26 15:53:22 +0700
message:
  bugfix for dhis2.period.js bi-monthly generator
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.period.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/dhis2/dhis2.period.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.period.js	2014-11-15 13:26:06 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.period.js	2014-11-26 08:53:22 +0000
@@ -591,7 +591,7 @@
     var year = offset + this.calendar.today().year();
     var periods = [];
 
-    for( var month = 1; month <= this.calendar.monthsInYear(year); month += 2 ) {
+    for( var month = 1, idx = 1; month <= this.calendar.monthsInYear(year); month += 2, idx++ ) {
       var startDate = this.calendar.newDate(year, month, 1);
       var endDate = this.calendar.newDate(startDate).set(month + 1, 'm');
       endDate.set(endDate.daysInMonth(month + 1), 'd');
@@ -601,7 +601,7 @@
       period['endDate'] = endDate.formatDate(this.format);
       period['name'] = startDate.formatDate("MM") + ' - ' + endDate.formatDate('MM') + ' ' + year;
       period['id'] = 'BiMonthly_' + period['startDate'];
-      period['iso'] = startDate.formatDate("yyyymm") + 'B';
+      period['iso'] = startDate.formatDate("yyyy") + '0' + idx + 'B';
 
       period['_startDate'] = this.calendar.newDate(startDate);
       period['_endDate'] = this.calendar.newDate(endDate);