Dinesh Ambaliya

Dinesh Ambaliya

  • NA
  • 42
  • 80k

Confirm Date must be greater than Join Date using customeValidator

Aug 20 2012 3:06 AM
function validate_date(source, args) {
            var joinDate = document.getElementById('<%=txt_dateofjoin.ClientID %>').value;
            var confDate = document.getElementById('<%=txt_confirmationdate.ClientID %>').value;


            var dt = new Date(joinDate);
            var dt2 = new Date(confDate);
            var myDate = dt.format("mm-dd-yyyy");
            var myDate2 = dt2.format("mm-dd-yyyy");
            if (myDate < myDate2)
                args.IsValid = true;
            else
                args.IsValid = false;
        }
this code is not working. There are problem with "dt.format() function" I know it but how can I validate two dates now.

Answers (3)