Search code examples
javascripttwitter-bootstraptwitter-bootstrap-3bootstrap-datetimepicker

Bootstrap 3's DateTimePicker defaultDate from HTML markup


With Bootstrap 3 DateTimePicker, I understand that defaultDate can be configured via JS. Is it not possible to use the value of the input field as default?

Not working:

<input type="text" class="form-control" value="2016-01-15" data-date-format="L" />

Here's a JSFiddle attempt that is not working.

Thanks!


Solution

  • format: 'L' is the same as format: 'MM/DD/YYYY your textbox value does not match this format and thus is an "invalid date".

    If you need other formats to be valid us extraFormats