Вы захотите использовать параметры минимальной даты, чтобы установить нижнюю границу для выбора даты, например:
var currentTime = new Date()
var minDate = new Date(currentTime.getFullYear(), currentTime.getMonth(), +1); //first day of current month
$('#side-datepicker').datepicker({
minDate: minDate,
beforeShowDay: function (date) {
//getDate() returns the day (0-31)
if (date.getDate() == 1 || date.getDate() == 15) {
return [true, ''];
}
return [false, ''];
},
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link href="https://code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css" rel="stylesheet" type="text/css" />
<script src="https://code.jquery.com/jquery-3.1.0.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<input id="side-datepicker">
Если вы хотите ограничить его только текущим месяцем и днями, которые не прошли. Например, допустимы только 1-е и 15-е, но сегодня 25 октября (после 1-го и 15-го), поэтому первой доступной датой для выбора будет 1-е ноября, а затем вы измените минимальную дату следующим образом:
var minDate = new Date(currentTime.getFullYear(), currentTime.getMonth(), currentTime.getDate()); //current date
ex:
var currentTime = new Date()
var minDate = new Date(currentTime.getFullYear(), currentTime.getMonth(), currentTime.getDate()); //current date
$('#side-datepicker').datepicker({
minDate: minDate,
beforeShowDay: function (date) {
//getDate() returns the day (0-31)
if (date.getDate() == 1 || date.getDate() == 15) {
return [true, ''];
}
return [false, ''];
},
});
<link href="https://code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css" rel="stylesheet" type="text/css" />
<script src="https://code.jquery.com/jquery-3.1.0.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<input id="side-datepicker">