简体   繁体   中英

JQuery. Disable minDate in DateTimePicker

I create DateTimePicker like this:

 $wnd.$("#" + id).datetimepicker({
    minDate: 0,
       .............
 });

I want to disable minDate option prorammatically. I try next, but it don't work:

      try {
        $wnd.$("#" + id).datetimepicker({minDate: new Date(1970, 01 - 1, 01)}); 
      }
      catch(e) {
        $wnd.$("#" + id).datetimepicker('option', 'minDate', new Date(1970, 01 - 1, 01));        
      }

PSDo not pay attention to the $wnd variable. It's work fine.

assuming u're talking about this plugin , wich is based on the jquery-ui-datepicker , just set minDate to null according to the documentation :

Set a minimum selectable date via a Date object or as a string in the current dateFormat, or a number of days from today (eg +7) or a string of values and periods ('y' for years, 'm' for months, 'w' for weeks, 'd' for days, eg '-1y -1m'), or null for no limit .

   $wnd.$("#" + id).datetimepicker(
    'option', 
    'minDate', new Date()
   ));

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