javascript - pickaday.js user can select any date from next 15 days only -


i'm using pickaday.js. want user able select date between today , next 15 dates. have set current date using javascript new date() function i'm unable figure out how set max day next 15 days only. please check 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)             }); 

just set maxdate this

maxdate: new date(currentdate.gettime() + 15 * 24 * 60 * 60 * 1000) 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -