I'm using pickaday.js
. I want the user to only be able to select a date between today and the next 15 dates. I have set current date by using javascript new Date()
function but I'm unable to figure out how to set max day to next 15 days only. Please check my code below
HTML
<input value="" id="datepicker" type="text" readonly>
SCRIPT
var currentDate = new Date();
var day = currentDate.getDate();
var month = currentDate.getMonth() + 1;
var year = currentDate.getFullYear();
var picker = new Pikaday(
{
field: document.getElementById('datepicker'),
firstDay: 1,
format: "DD/MM/YYYY",
minDate: new Date(year, month, day),
maxDate: new Date(2020, 12, 31)
});