I have search date range 'from date' & 'to date' my validation function make data valid if range of date is not in same month ? for example if from date"2015-06-02" to date "2015-06-01" the range is invalid range? but if I make the to date "2015-05-31" it will be valid range
var validateDateRange = function () {
var fromDate = moment($scope.model.fromDateSearch, 'MM-DD-YYYY');
var toDate = moment($scope.model.toDateSearch, 'MM-DD-YYYY');
var a = (fromDate > toDate) ;
return a;
};
There is some problem with date format you are passing. So it would also work if you just remove the format and just pass in the value.
Run and check the code snippet below its working fine