简体   繁体   中英

Previous date selection in bootstrap datepicker

i have disable the previous date in bootstrap date picker but at the time of edit i want to display the save date (if the save date is previous its not showing in date field.

$(function () {
  $('#datetimepicker1').datetimepicker({
    format: 'YYYY-MM-DD',  
    minDate:new Date()    
  });
});

Instead of passing:

minDate:new Date()

make it conditional, by calling a function and check if it is add or edit and on the behalf of that condition do something like:

$("#datepicker").datepicker({
    minDate:mdate()
});


function mdate(){
  if( 'add' )
  {
    // retrun what ever date you want
  }
  else
  {
    // retrun something else
  }
}

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