jQuery: Datepicker # Dates Selected

Hi, trying to calculate the days between the two datepickers on this page.

What I have so far in JS:

$("#booking_calender").datepicker({
minDate: 0,
maxDate: '+1Y+6M',
onSelect: function (dateStr) {
var min = $(this).datepicker('getDate'); // Get selected date
$("#booking_calender_checkout").datepicker('option', 'minDate', min || '0'); // Set other min, default to tod
}
});

$("#booking_calender_checkout").datepicker({
minDate: '0',
maxDate: '+1Y+6M',
onSelect: function (dateStr) {
var max = $(this).datepicker('getDate'); // Get selected date
$('#datepicker').datepicker('option', 'maxDate', max || '+1Y+6M'); // Set other max, default to +18 months
var start = $("#booking_calender").datepicker("getDate");
var end = $("#booking_calender_checkout").datepicker("getDate");
var days = (end - start) / (1000 * 60 * 60 * 24);
$( '.caption.product-calc-days span.numDays' ).append( document.createTextNode( days ) );
}
});

The html:

Datepicker 1:

<input type="text" id="booking_calender" name="booking_calender" class="booking_calender hasDatepicker" style="cursor: text!important;" readonly="" placeholder="Delivery">

Datepicker 2:

<input type="text" id="booking_calender_checkout" name="booking_calender_checkout" class="booking_calender hasDatepicker" style="cursor: text!important;" readonly="" placeholder="Drop Off">

html where the # of days should post (.numDays):

<div class="caption product-calc-days">Total Rental Days: <span class="numDays"></span></div>

I feel like I am almost there! Appreciate any help :slight_smile:

Luke