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;
}

Priyanka JainRank #356 · 7K reputationPosted Sep 19, 2019, 11:49 PM EDT
Bidyasagar MishraRank #766 · 3K reputationPosted Sep 19, 2019, 10:01 PM EDT
Jaimin ShethiyaRank #177 · 13.7K reputationPosted Sep 19, 2019, 10:35 PM EDT
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.
Sonu GuptaRank #1,261 · 1.4K reputationPosted Sep 20, 2019, 9:58 AM EDT
Tamil Selvan119 reputationPosted Sep 20, 2019, 10:19 PM EDT