Merge pull request #680 from shreesh-webkul/gli-1392

Fixed: Datepicker not initializing on initial load of room type page with preperation time
This commit is contained in:
Rohit Jain
2023-04-10 20:27:16 +05:30
committed by GitHub

View File

@@ -1361,6 +1361,14 @@ var BookingForm = {
if (preparation_time) {
start_date.setDate(start_date.getDate() + parseInt(preparation_time));
start_date.setHours(0, 0, 0, 0);
if (dateFrom && new Date(dateFrom + ' 00:00:00') < start_date) {
dateFrom = $.datepicker.formatDate('yy-mm-dd', start_date);
if (new Date(dateTo + ' 00:00:00') <= start_date) {
dateTo = new Date(start_date);
dateTo.setDate(start_date.getDate() + 1);
dateTo = $.datepicker.formatDate('yy-mm-dd', dateTo);
}
}
}
if (max_order_date) {
@@ -1384,7 +1392,6 @@ var BookingForm = {
max_order_date = $.datepicker.formatDate('dd-mm-yy', max_order_date);
}
$('#room_date_range').dateRangePicker({
startDate: $.datepicker.formatDate('dd-mm-yy', new Date()),
endDate: max_order_date,
startDate: start_date,
}).on('datepicker-change', function(event,obj){