Skip to content

Commit

Permalink
Update hc-utils.js
Browse files Browse the repository at this point in the history
method 'isValidDob' updated
  • Loading branch information
amit-kumar27 committed Dec 16, 2015
1 parent 798d356 commit d69c8ae
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion hc-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,16 @@
this.MAX_AGE = angular.isDefined(range.maxAge) ? range.maxAge : 120;
}
var d = this.getMomentDate(date,dateFormat),
age = moment().diff(d, 'years');
age = moment().diff(d, 'years', true),
currentDate = new Date(),
_date = new Date(date);

//'moment().diff()' function returns greater floating point value when dates are same
//below code will handle this case
if(currentDate.getDate() === _date.getDate())
{
age = parseInt(age);
}
return this.isValidAge(age);
},
isDateAfter = function(d,date,dateFormat){
Expand Down

0 comments on commit d69c8ae

Please sign in to comment.