Hi Team
As I am trying the candidate age should be greater than 18 in card schema for that I succeed. but how to calculate in months and date
Here is my code please check once
AgeValidator: function() {
// Variable for storing a validation error message.
var invalidMessage = "";
var startDate = this.get("UsrDateOfBirth");
var isValid = Ext.isEmpty(startDate);
if(!isValid)
{
var endDate = new Date();
var oneDay = 24 * 60 * 60 * 1000 * 365; // hours*minutes*seconds*milliseconds
var diffDays = Math.round(Math.abs((startDate.getTime() - endDate.getTime()) / oneDay));
// invalidMessage = diffDays;
if (diffDays < 18)
{
invalidMessage = this.get("Resources.Strings.datevalidation");
}
}
return {
invalidMessage: invalidMessage
};
},
Hoping for positive reply.
Like