WelcomeTo
WelcomeTo

Reputation: 20571

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));        
      }

P.S.Do not pay attention to the $wnd variable. It's work fine.

Upvotes: 2

Views: 1838

Answers (2)

sandeep
sandeep

Reputation: 2234

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

Upvotes: 1

oezi
oezi

Reputation: 51797

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 (e.g. +7) or a string of values and periods ('y' for years, 'm' for months, 'w' for weeks, 'd' for days, e.g. '-1y -1m'), or null for no limit.

Upvotes: 2

Related Questions