使用daterangepicker插件进行此预订。改进所需的额外要求。
HTML:
<input class="form-control input-lg" id="returnTripDepart" name="ReturnTrip" />
JS:
$('#returnTripDepart').click(function(){
$('.daterangepicker').addClass('returnTripDatePicker');
$('.departure--date').hide();
$(".returnTripDatePicker").prepend("<div class='departure--date'>Select Departure Date</div>");
});
var nowDate = new Date();
var today = new Date(nowDate.getFullYear(), nowDate.getMonth(), nowDate.getDate(), 0, 0, 0, 0);
var maxLimitDate = new Date(nowDate.getFullYear() + 1, nowDate.getMonth(), nowDate.getDate(), 0, 0, 0, 0);
$('input[name="ReturnTrip"]').daterangepicker({
"autoApply": true,
"autoUpdateInput": false,
"minDate": today,
"maxDate": maxLimitDate,
"locale": {
format: 'DD MMM YYYY'
}
},function(start:any, end:any) {
$("#returnTripDepart").val(start.format('DD MMM YYYY'));
$("#returnTripReturn").val(end.format('DD MMM YYYY'));
});