Fiddle: https://jsfiddle.net/ek9c9ojx/3/
I tried numerous solutions from this question: set default time in bootstrap-datetimepicker
But none of them worked. They all cause the input to be empty and default to the placeholder text.
I tried the setDate()
, setLocalDate()
, and defaultDate
routes but I can't find anything in the current documentation supporting these or any current methods that work to achieve this simple task.
None of these work:
var dateObj = new Date('2016-03-21T23:31:00');
// does not work, causes empty input/placeholder text
$("#startdatetime-from").data('datetimepicker').setDate(dateObj);
// does not work, causes empty input/placeholder text
$("#startdatetime-from").data('datetimepicker').setLocalDate(dateObj);
var dateObj = new Date('2016-03-21T23:31:00');
$('#new-challenge-date-time-picker').datetimepicker({
minDate: moment(),
defaultDate: dateObj // does not work, same symptoms as above
});
I also tried setting the value
attribute of the #new-challenge-date-time-picker
itself, but that did not work either.
Does anyone have the answer?