Бронирование 2
$(function() {
$( "#arrive_date" ).datepicker( { showOn: "button", buttonImage: "https://sohoazov.ru/wp-content/themes/castello/images/calendar_icon.png", buttonText: "Откройте календарь и выберите даты", buttonImageOnly: true, showOtherMonths: true, showButtonPanel:true, closeText: "", defaultDate: 0, minDate:0, dateFormat: 'dd.mm.yy', onClose: function( selectedDate ) { var dateString = selectedDate; // date string var dt1 = parseInt(selectedDate.substring(0,2)); var mon1 = parseInt(selectedDate.substring(3,5)); var yr1 = parseInt(selectedDate.substring(6,10)); var actualDate = new Date(yr1, mon1-1, dt1); var newDate = new Date(actualDate.getFullYear(), actualDate.getMonth(), actualDate.getDate()+1); // create new increased date var newDateString = ("0" + newDate .getDate()).slice(-2) + "." + ("0"+(newDate .getMonth()+1)).slice(-2) + "." + newDate.getFullYear();
//$( "#depature_date" ).datepicker( "option", "minDate", newDateString ); //$( "#depature_date" ).datepicker( "option", "setDate", newDateString ); $('#depature_date').attr('value', newDateString); $('input[name="checkoutYear"]').attr('value', parseInt(newDateString.substring(6,10))); $('input[name="checkoutMonth"]').attr('value', parseInt(newDateString.substring(3,5))); $('input[name="checkoutDay"]').attr('value', parseInt(newDateString.substring(0,2))); }
}); $( "#depature_date" ).datepicker( { showOn: "button", buttonImage: "https://sohoazov.ru/wp-content/themes/castello/images/calendar_icon.png", buttonText: "Откройте календарь и выберите даты", buttonImageOnly: true, showOtherMonths: true, showButtonPanel:true, closeText: "", defaultDate: 0, minDate:0, dateFormat: 'dd.mm.yy'
});
var newDate = new Date(); newDate.setDate(newDate.getDate());
$('#arrive_date').attr('value', ('0'+newDate.getDate()).slice(-2) + '.' + ('0'+(newDate.getMonth()+1)).slice(-2) + '.' + newDate.getFullYear());
newDate.setDate(newDate.getDate() +1) $('#depature_date').attr('value', ('0'+newDate.getDate()).slice(-2) + '.' + ('0'+(newDate.getMonth()+1)).slice(-2) + '.' + newDate.getFullYear());
});