Date Validation for JavaScript

The below code is check-in entering string is current date or previous date, the previous date did not include Saturday and Sunday.
 
ASPX Page
  1. <aspx:TextBox runat="server" id="txtvalid" ></asp:TextBox>  
  2. lt;asp:Button ID="btnsave" Text="Create User" runat="server" OnClientClick="dateValidation(this);"/>         
Script
  1. function dateValidation(evt) {  
  2.     var d = new date();  
  3.     var n = d.getDay();  
  4.     var text = document.getElementById("txtvalid").value;  
  5.     var today = new date();  
  6.     var dd = today.getDate();  
  7.     var mm = today.getmonth() + 1;  
  8.     var yyyy = today.getFullYear();  
  9.     if (dd < 10) {  
  10.         dd = '0' + dd  
  11.     }  
  12.     if (mm < 10) {  
  13.         mm = '0' + mm  
  14.     }  
  15.     today = dd + '/' + mm + '/' + yyyy  
  16.     if (n = 1)  
  17.         var yest = dd - 3;  
  18.     else  
  19.         var yest = dd - 1;  
  20.     var yestrday = yest + '/' + mm + '/' + yyyy  
  21.     if (text != today && (text != yesterday)) {  
  22.         alert('Please Enter current date or previous date'  
  23.         }  
  24.     }  

Thanks Sreejesh
Next Recommended Reading Birth Date Validation in JavaScript