Search code examples
jquerydatetimepickereonasdan-datetimepicker

datetimepicker minDate issue


I am setting minDate and maxDate on datetimepicker.

minDate is showing as selectable but when I click it, it does not update the input control. Selecting maxDate works fine.

Here is the fiddle: https://jsfiddle.net/zlaja1983/t23z4hLd/

var minDate = moment().subtract(7, 'days');
var maxDate = moment();
$('#datetimepicker1').datetimepicker({
  minDate: minDate,
  maxDate: maxDate,
  showClear: false,
  useCurrent: false,
  format: 'l'
});

Solution

  • Seems to be an issue with the plugin. See fiddle.

    For some reason, this works...

    var minDate = moment().subtract(7, 'days').millisecond(0).second(0).minute(0).hour(0);
    

    Found the solution on their Github issue tracker.

    Edit: Just realized that you're the same person who opened the issue on Github. Haha.