I have a question how do I get nubmber between 2 different dates using JS. I currently have booking calendar wich works fine but I have no idea how could I make when someones clicks leave date on calendar that it would change price to days between arrival and leave date and * 45$ (let's say 45 is the price/night). https://i.stack.imgur.com/Bxqdu.jpg
Here's my code of datepicker:
$(document).ready(function(){
var array = <?php echo json_encode($seznamkoncni); ?>;
function DisableDates(date) {
var string = jQuery.datepicker.formatDate('dd.mm.yy', date);
return [dates.indexOf(string) == -1];
}
$('#date1').datepicker({
minDate: 0,
changeMonth: true,
changeYear: true,
beforeShowDay: function(date){
var string = jQuery.datepicker.formatDate('dd.mm.yy', date);
return [ array.indexOf(string) == -1 ]
},
onSelect: function(dateStr) {
var newDate = $(this).datepicker('getDate');
if (newDate) {
newDate.setDate(newDate.getDate() + 1);
}
$('#date2').datepicker('setDate', newDate).datepicker('option', 'minDate', newDate);
}
});
});
$(document).ready(function(){
var array = <?php echo json_encode($seznamkoncni); ?>;
function DisableDates(date) {
var string = jQuery.datepicker.formatDate('dd.mm.yy', date);
return [dates.indexOf(string) == -1];
}
$('#date2').datepicker({
minDate: 0,
changeMonth: true,
changeYear: true,
beforeShowDay: function(date){
var string = jQuery.datepicker.formatDate('dd.mm.yy', date);
return [ array.indexOf(string) == -1 ]
}
});
});