How to find difference between two dates displayed in two text boxes ?.I was using following code and what i want is if the date difference goes beyond 90 days then i have to show some message to user.Here dates are dd/MM/yyyy format ,so here if i select from date as 23/8/17 and todate as 9/11/2017 ,the difference is coming as 423 days why?
function checkDate() {
debugger;
var txtdate1 = document.getElementById('<%= txtFromDate.ClientID %>').value;
var txtdate2 = document.getElementById('<%= txtToDate.ClientID %>').value;
var date1 = new Date(txtdate2 );
var date2 = new Date(txtdate1);
var timeDiff = Math.abs(date2.getTime() - date1.getTime());
var diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24));
if (diffDays > 90) {
var Message = 'Dates are too far apart,It should be with in 3 months';}