简体   繁体   中英

datepicker disable futures dates and display today date as default date

I would like to display today's date in my datapicker and in the same time disable future dates. For the moment I can only do one option, I can just disable future dates or I can display today's date.

here is my code:

  $('#datepicker').datepicker({
                format: "dd-mm-yyyy",
                endDate: today,
            });
  $('#datepicker').datepicker('setDate', new Date());

$( "#datepicker" ).datepicker({
dateFormat:"dd-mm-yy",
maxDate : new Date()
});

MaxDate helps you to limit the future dates

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM