I am working on converting a form to utilize VueJS. The form has an input for a date of birth that uses eonasdan/bootstrap-datetimepicker (http://eonasdan.github.io/bootstrap-datetimepicker/).
The problem is that when I change the value of the dob
input with DateTimePicker, VueJS does not bind to this. It only works if the user directly types in the input, which is what I'm trying to avoid (to properly format the date).
The input itself is nothing special:
<div class="input-group date">
<input id="dob"
v-model="newCamper.dob"
placeholder="MM-DD-YYYY"
class="form-control"
name="dob" type="text">
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
UPDATE
I also tried this with digitalbrush Masked Input Plugin, the same result. It seems that anything other than just plain typing in an input is not recognized by Vue. However, this works - although it's a bit clunky:
$(document).ready(function () {
var dob = $("#dob");
dob.mask("99/99/9999",{placeholder:"MM/DD/YYYY"});
dob.change(function()
var value = $(this).val();
vm.$data.newCamper.dob = value;
})
});