function ValidateDate()
{
var FrDateSelect =document.getElementById('<%=ddlfrDate.ClientID%>').value;
var ToDateSelect =document.getElementById('<%=ddlToDate.ClientID%>').value;
var diffDays = (new Date(ToDateSelect) - new Date(FrDateSelect))/ (1000 * 60 * 60 * 24* 30);
if(new Date(ToDateSelect)<new Date(FrDateSelect))
{
alert('From Date Cannot be Greater than To Date');
return false;
}
else if(diffDays>4)
{
alert('select only range of any 3 months');
return false;
}
else
{
return true;
}
}
{
var FrDateSelect =document.getElementById('<%=ddlfrDate.ClientID%>').value;
var ToDateSelect =document.getElementById('<%=ddlToDate.ClientID%>').value;
var diffDays = (new Date(ToDateSelect) - new Date(FrDateSelect))/ (1000 * 60 * 60 * 24* 30);
if(new Date(ToDateSelect)<new Date(FrDateSelect))
{
alert('From Date Cannot be Greater than To Date');
return false;
}
else if(diffDays>4)
{
alert('select only range of any 3 months');
return false;
}
else
{
return true;
}
}
No comments:
Post a Comment