I am starting to use the Datepicker
of Bootstrap
because I need to capture 2 dates to make a query of hours worked, my problem is that I generate this error:
jquery-3.2.1.min.js: 2 Uncaught TypeError: $ (...). datetimepicker is not a function at HTMLDocument. (dashboard.js: 12) at j (jquery-3.2.1.min.js: 2) at k (jquery-3.2.1.min.js: 2)
I do not know why, I already have installed the libraries of Bootstrap
and jQuery
I do not know what I need.
This is my HTML code:
<div class="datepick container">
<div class="col-md-5">
<label>Desde:</label>
<div class="form-group">
<div class="input-group date" id="datetimepicker1">
<input type="text" class="form-control" />
<span class="input-group-addon">
<span class="gyphicon gyphicon-calendar"></span>
</span>
</div>
</div>
</div>
<div class="col-md-5">
<label>Hasta:</label>
<div class="form-group">
<div class="input-group date" id="datetimepicker2">
<input type="text" class="form-control" />
<span class="input-group-addon">
<span class="gyphicon gyphicon-calendar"></span>
</span>
</div>
</div>
</div>
</div>
and this is the JavaScript:
$(function () {
$('#datetimepicker1').datetimepicker();
$('#datetimepicker2').datetimepicker({
useCurrent: false,
format: 'YY.MM.DD'
});
$("#datetimepicker1").on("dp.change", function (e) {
$('#datetimepicker2').data("DateTimePicker").minDate(e.date);
});
$("#datetimepicker2").on("dp.change", function (e) {
$('#datetimepicker1').data("DateTimePicker").maxDate(e.date);
});
});