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
- <aspx:TextBox runat="server" id="txtvalid" ></asp:TextBox>
- lt;asp:Button ID="btnsave" Text="Create User" runat="server" OnClientClick="dateValidation(this);"/>
Script
- function dateValidation(evt) {
- var d = new date();
- var n = d.getDay();
- var text = document.getElementById("txtvalid").value;
- var today = new date();
- var dd = today.getDate();
- var mm = today.getmonth() + 1;
- var yyyy = today.getFullYear();
- if (dd < 10) {
- dd = '0' + dd
- }
- if (mm < 10) {
- mm = '0' + mm
- }
- today = dd + '/' + mm + '/' + yyyy
- if (n = 1)
- var yest = dd - 3;
- else
- var yest = dd - 1;
- var yestrday = yest + '/' + mm + '/' + yyyy
- if (text != today && (text != yesterday)) {
- alert('Please Enter current date or previous date'
- }
- }
- }
Thanks Sreejesh