Search code examples
javascripttwitter-bootstrapdatetimepickereonasdan-datetimepicker

Working with Eonasdan datetime picker


I have implemented datetimepicker as follows:

$('#txtStartDate').datetimepicker({ useCurrent: false, locale: _defaultCulture[0], format: 'L' });
$('#txtEndDate').datetimepicker({ useCurrent: false, locale: _defaultCulture[0], format: 'L' });

Can anyone tell how can I disable date before to current/today's date?

I read the documentation on http://eonasdan.github.io/bootstrap-datetimepicker/Options/#mindate, but not able to implement as it is.


Solution

  • Try the following in your JS

    Include moment.js in your external js.(moment.js is must to use Eonasdan datetime picker).

    As mentioned by @VincenzoC For more details follow the link

    $(function() {
      $('#YourID').datetimepicker({
        format: 'L',
        useCurrent: false,
        minDate: moment()
      });
    
    });
    

    Fiddle