I'm trying to get the date values to query my database. I keep getting undefined
. I have checked all the documentation and I cannot find a way to get data. I'm using this bootstrap datetime picker
HTML file:
<div class="form-group">
<label for="to" class="col-md-2 control-label">Start Date</label>
<div class="input-group date to col-md-5" data-date="2017-01-01T05:25:07Z" data-link-field="dtp_input1">
<input class="form-control" size="16" type="text" value="" readonly>
<span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
<span class="input-group-addon"><span class="glyphicon glyphicon-th"></span></span>
</div>
<input type="hidden" id="from" value="" /><br/>
</div>
JavaScript file:
$(".to").datetimepicker({
format: "yyyy-mm-ddThh:ii:ssZ",
onSelect: function() {
endValue = $(this).datetimepicker('getDate');
}
});
//console.log(endValue);
$(".to").datetimepicker()
.on('change', function( evt ) {
startValue = $('#to').val();
});