← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15112: minor fixes for date range picker

 

------------------------------------------------------------
revno: 15112
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-04-29 20:35:30 +0545
message:
  minor fixes for date range picker
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-04-29 14:29:01 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.period.js	2014-04-29 14:50:30 +0000
@@ -83,8 +83,12 @@
   var $toEl = $(toEl);
 
   mergedOptions.onSelect = function( dates ) {
-    $fromEl.calendarsPicker("option", "maxDate", dates[0] || null);
-    $toEl.calendarsPicker("option", "minDate", dates[0] || null);
+    if( this.id === $fromEl.attr('id') ) {
+      $toEl.calendarsPicker("option", "minDate", dates[0] || null);
+    }
+    else if( this.id === $toEl.attr('id') ) {
+      $fromEl.calendarsPicker("option", "maxDate", dates[0] || null);
+    }
   };
 
   $fromEl.calendarsPicker(mergedOptions);
@@ -94,6 +98,9 @@
   });
 
   $toEl.calendarsPicker(toOptions);
+
+  $fromEl.calendarsPicker("setDate", $fromEl.calendarsPicker("getDate"));
+  $toEl.calendarsPicker("setDate", $toEl.calendarsPicker("getDate"));
 };
 
 /**