Reputation: 139
I mean this Datepicker:
https://uxsolutions.github.io/bootstrap-datepicker/
HTML:
<div id="sandbox-container">
<label for="date_start">Fecha de inicio</label>
<input type="text" class="form-control">
<label for="date_end">Fecha de termino</label>
<input type="text" class="form-control">
</div>
JavaScript:
$('#sandbox-container input').datepicker({});
To be more specific, I mean how can I limit the selection to only 1 month, 1-X week or X day that total 1 month, but can not be selected for more than 1 month.
Example:
Upvotes: 0
Views: 77
Reputation: 216
I was not able to test this one, but according to the documentation and option it could look like this one
HTML:
<div id="sandbox-container" class='start'>
<label for="date_start">Fecha de inicio</label>
<input type="text" class="form-control">
</div>
<div id="sandbox-container" class='end'>
<label for="date_end">Fecha de termino</label>
<input type="text" class="form-control">
</div>
Script:
$('.start').datepicker();
$('.end').datepicker();
$(".start").on("dp.change", function (e) {
var startDate = e.date
var split = startDate.split("-");
var maxDate = (split[0] + "-31-" + split[2])
$('.end').data("DatePicker").maxDate(maxDate);
});
According to your dateformat like this: MM-DD-YYYY
Hope this helps
Upvotes: 1