There is a problem when I set the maxdate based on current date.
Here is the code:
var minDate = new Date();
var maxDate = new Date();
function myFunction() {
maxDate.setDate(new Date().getDate() + 60);
document.getElementById("demo").innerHTML = maxDate;
}
<p>Click the button to display the maxDate</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
Everytime I click on a button date is increasing by 60 days.
I want to validate it with the date entered in date input, my validation is as below.
Date entered in input should be between current date and 60 days after current date.
Output:
On click of button.
1st Click : Tue Aug 28 2018 11:36:52 GMT+0530 (India Standard Time)
2nd Click : Sun Oct 28 2018 11:36:52 GMT+0530 (India Standard Time)
3rd Click : Fri Dec 28 2018 11:36:52 GMT+0530 (India Standard Time)
Please help.