}
//
});
- var start, context, context2, end, arrival, currentDate, currentDate2, requiredDate, requiredDate1, minDays, departure, stay, d, dd, m, y, bayView = 'vD4ZpIFk4%2b7FyPsaBnkCqP1cBHWnJili9k5D83MqJq4%3d&',
+ var start, nights, extraDay, end, arrival, currentDate, currentDate2, requiredDate, requiredDate1, minDays, departure, stay, d, dd, m, y, bayView = 'vD4ZpIFk4%2b7FyPsaBnkCqP1cBHWnJili9k5D83MqJq4%3d&',
crookedRiver = 'ZhWXD46i2%2fq319vcR%2fcw69rZvA2bz%2fttOOxO9t1%2fBJ0%3d&',
adults,
kids,
$("#arrive").datepicker({
minDate: 0,
onSelect: function (date) {
- $("#arrive").datepicker({dateFormat: 'mm/dd/yy'}).val();
- arrival = $("#arrive").datepicker('getDate');
- d = arrival.getDate();
- dd = arrival.getDate() + 1;
- m = arrival.getMonth() + 1;
- y = arrival.getFullYear();
- minDays = m + '/' + dd + '/' + y;
- console.log(minDays);
- arrival = d + '-' + m + '-' + y; // to pass as a date value in the url
- start = "arrival_date=" + y + '-' + m + '-' + d + '&'; // for date parsing to get length of stay
- arrival.toString();
- arrival = arrival.replace(/\//g, "");
- arrival = parseInt(arrival, 10);
- $("#depart").datepicker("option", "minDate", minDays);
+ $("#arrive").datepicker({dateFormat: 'yy-mm-dd'}).val();
+ currentDate = $("#arrive").datepicker('getDate');
+ extraDay = $("#arrive").datepicker('getDate');
+ extraDay.setDate(extraDay.getDate() + 1);
+ $("#depart").datepicker("option", {minDate: new Date(extraDay)});
+
+ // set up variables to pass to booking site
+ currentDate = new Date(currentDate);
+ currentDate = new Date(currentDate.getUTCFullYear(), currentDate.getUTCMonth(), currentDate.getUTCDate());
+ currentDate.setDate(currentDate.getDate());
+ d = currentDate.getDate();
+ if (d <= 9) {
+ d = '0' + d;
+ }
+ m = currentDate.getMonth() + 1;
+ if (m <= 9) {
+ m = '0' + m;
+ }
+ y = currentDate.getFullYear();
+ start = "arrival_date=" + y + '-' + m + '-' + d + '&';
}
- });
-
+ });
$("#depart").datepicker({
onSelect: function (date) {
- $("#depart").datepicker({dateFormat: 'mm/dd/yy'}).val();
+ $("#depart").datepicker({dateFormat: 'yy-mm-dd'}).val();
departure = $("#depart").datepicker('getDate');
- d = departure.getDate();
- m = departure.getMonth() + 1;
- y = departure.getFullYear();
- departure = d + '-' + m + '-' + y;
- end = y + '-' + m + '-' + d + '&';
- departure.toString();
- departure = departure.replace(/\//g, "");
- departure = parseInt(departure, 10);
- $("#nights").val(departure - arrival);
- stay = 'stay_nights=' + (departure - arrival) + '&';
+ $("#nights").val(Math.ceil(departure - currentDate) / (1000 * 60 * 60 * 24));
+ stay = 'stay_nights=' + $('#nights').val() + '&';
+
}
});
$("#arriveCal").click(function () {
}
//
});
- var start, context, context2, end, arrival, currentDate, currentDate2, requiredDate, requiredDate1, minDays, departure, stay, d, dd, m, y, bayView = 'vD4ZpIFk4%2b7FyPsaBnkCqP1cBHWnJili9k5D83MqJq4%3d&',
+ var start, nights, extraDay, end, arrival, currentDate, currentDate2, requiredDate, requiredDate1, minDays, departure, stay, d, dd, m, y, bayView = 'vD4ZpIFk4%2b7FyPsaBnkCqP1cBHWnJili9k5D83MqJq4%3d&',
crookedRiver = 'ZhWXD46i2%2fq319vcR%2fcw69rZvA2bz%2fttOOxO9t1%2fBJ0%3d&',
adults,
kids,
$("#arrive").datepicker({
minDate: 0,
onSelect: function (date) {
- $("#arrive").datepicker({dateFormat: 'mm/dd/yy'}).val();
- arrival = $("#arrive").datepicker('getDate');
- d = arrival.getDate();
- dd = arrival.getDate() + 1;
- m = arrival.getMonth() + 1;
- y = arrival.getFullYear();
- minDays = m + '/' + dd + '/' + y;
- console.log(minDays);
- arrival = d + '-' + m + '-' + y; // to pass as a date value in the url
- start = "arrival_date=" + y + '-' + m + '-' + d + '&'; // for date parsing to get length of stay
- arrival.toString();
- arrival = arrival.replace(/\//g, "");
- arrival = parseInt(arrival, 10);
- $("#depart").datepicker("option", "minDate", minDays);
+ $("#arrive").datepicker({dateFormat: 'yy-mm-dd'}).val();
+ currentDate = $("#arrive").datepicker('getDate');
+ extraDay = $("#arrive").datepicker('getDate');
+ extraDay.setDate(extraDay.getDate() + 1);
+ $("#depart").datepicker("option", {minDate: new Date(extraDay)});
+
+ // set up variables to pass to booking site
+ currentDate = new Date(currentDate);
+ currentDate = new Date(currentDate.getUTCFullYear(), currentDate.getUTCMonth(), currentDate.getUTCDate());
+ currentDate.setDate(currentDate.getDate());
+ d = currentDate.getDate();
+ if (d <= 9) {
+ d = '0' + d;
+ }
+ m = currentDate.getMonth() + 1;
+ if (m <= 9) {
+ m = '0' + m;
+ }
+ y = currentDate.getFullYear();
+ start = "arrival_date=" + y + '-' + m + '-' + d + '&';
}
- });
-
+ });
$("#depart").datepicker({
onSelect: function (date) {
- $("#depart").datepicker({dateFormat: 'mm/dd/yy'}).val();
+ $("#depart").datepicker({dateFormat: 'yy-mm-dd'}).val();
departure = $("#depart").datepicker('getDate');
- d = departure.getDate();
- m = departure.getMonth() + 1;
- y = departure.getFullYear();
- departure = d + '-' + m + '-' + y;
- end = y + '-' + m + '-' + d + '&';
- departure.toString();
- departure = departure.replace(/\//g, "");
- departure = parseInt(departure, 10);
- $("#nights").val(departure - arrival);
- stay = 'stay_nights=' + (departure - arrival) + '&';
+ $("#nights").val(Math.ceil(departure - currentDate) / (1000 * 60 * 60 * 24));
+ stay = 'stay_nights=' + $('#nights').val() + '&';
+
}
});
$("#arriveCal").click(function () {