I have a text box where i will be giving the date in text box and i need to compare that given date in text box with todays date it working for past date which is the expected reult but if i am giving future date its still showing me the validation instead of inserting the date.How can i resolve this issue
Below is my code that i have used
var currentdate = new Date();
var todayDate = (currentdate.getMonth() + 1) + "/" + currentdate.getDate() + "/" + currentdate.getFullYear();
if ($("#txtDate").val() < todayDate) //txtdate is 10/20/2019 and today date is 09/20/2019 but still i am getting validation which should not happen
{
MessageDisp('divAlertMessage', "Date Cannot Be Less Than Today's Date.", 'Error');
return false;
}
5 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Tamil SelvanPosted Sep 21, 2019, 2:19 AM
Sonu GuptaPosted Sep 20, 2019, 1:58 PM
Priyanka JainPosted Sep 20, 2019, 3:49 AM
Jaimin ShethiyaPosted Sep 20, 2019, 2:35 AM
I have tried but its working fine for me.
can you please check the below screen shot for date validation and let me know you want to need anything on that.
Bidyasagar MishraPosted Sep 20, 2019, 2:01 AM