dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #34930
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17919: d2Date - make sure typed dates are validated against future date setting
------------------------------------------------------------
revno: 17919
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-01-08 18:49:09 +0100
message:
d2Date - make sure typed dates are validated against future date setting
modified:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/angular/plugins/dhis2/directives.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/angular/plugins/dhis2/directives.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/angular/plugins/dhis2/directives.js 2015-01-05 17:28:31 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/angular/plugins/dhis2/directives.js 2015-01-08 17:49:09 +0000
@@ -471,9 +471,7 @@
showAnim: "",
renderer: $.calendars.picker.themeRollerRenderer,
onSelect: function(date) {
- ctrl.$setViewValue(date);
- $(this).change();
- scope.$apply();
+ $this.change();
}
})
.change(function() {
@@ -483,8 +481,14 @@
var isValid = rawDate == convertedDate;
var fieldName = element.attr('name');
+ if(isValid && maxDate === 0){
+ isValid = !moment(convertedDate, calendarSetting.momentFormat).isAfter(DateUtils.getToday());
+ }
+
ctrl.$setViewValue(isValid ? this.value : undefined);
- ctrl.$setValidity(fieldName, isValid);
+ ctrl.$setValidity(fieldName, isValid);
+
+ this.focus();
scope.$apply();
});
}