Set minDate to Today in Bootstrap DateTimePicker

Giantsfan542 picture Giantsfan542 · Nov 23, 2014 · Viewed 61.5k times · Source

I'm using Bootstrap DateTime Picker (http://eonasdan.github.io/bootstrap-datetimepicker/) and I've found the basic option to set a minDate; but, I can't get it to set to today to save my life. I've tried things like Date(); but, nothing working. Anyone have any ideas?

Example

    $('#date').datetimepicker({
        pickTime: false,
        icons: {
                time: "fa fa-clock-o",
                date: "fa fa-calendar",
                up: "fa fa-arrow-up",
                down: "fa fa-arrow-down"
            },
        startDate: new Date()
    });

Answer

Bart Jedrocha picture Bart Jedrocha · Nov 24, 2014

If you're using the latest version, the minDate option is what you'll need to set. Here is a JSFiddle with a working example. Hope this helps.

$('#date').datetimepicker({
    pickTime: false,
    icons: {
      time: "fa fa-clock-o",
      date: "fa fa-calendar",
      up: "fa fa-arrow-up",
      down: "fa fa-arrow-down"
    },
    minDate: moment()
});