I am currently utilizing the air-datepicker inline feature.
My objective is to establish the starting date for it.
Below is the script detailing my attempt:
export function load_datepickers_inline():void {
const search_legs_0_datepicker = $("#search_legs_0_datepicker");
const leg_0_datepicker = $("#search_legs_0_datepicker").datepicker({
language: gon.locale,
classes: 'inline-picker',
selectOtherMonths: true,
showOtherMonths: true,
changeMonth: true,
changeYear:true,
altField: '#search_legs_0_date',
selectDate: new Date(search_legs_0_datepicker.attr("data-defaultDate")),
minDate: new Date(search_legs_0_datepicker.attr('data-mindate')),
maxDate: new Date(search_legs_0_datepicker.attr('data-maxdate')),
altFormat: 'yy-mm-dd',
onSelect: (dateText, inst) => {
const date = new Date(dateText);
if (!leg_0_datepicker) { return false; }
leg_1_datepicker.datepicker("option", "minDate", date);
if ($("#search_legs_0_hotel_date").length > 0) {
$('#search_legs_0_hotel_date').datepicker().data('datepicker').update('minDate', date);
$('#search_legs_0_hotel_date').datepicker().data('datepicker').datepicker("setDate", date);
$('#search_legs_1_hotel_date').datepicker().data('datepicker').update('minDate', date);
}
}
})
const search_legs_1_datepicker = $("#search_legs_1_datepicker");
var leg_1_datepicker = $("#search_legs_1_datepicker").datepicker({
selectOtherMonths: true,
showOtherMonths: true,
language: gon.locale,
changeMonth: true,
changeYear:true,
classes: 'inline-picker',
altField: '#search_legs_1_date',
selectDate: new Date(search_legs_1_datepicker.attr("data-defaultDate")),
minDate: new Date(search_legs_1_datepicker.attr('data-mindate')),
maxDate: new Date(search_legs_1_datepicker.attr('data-maxdate')),
altFormat: 'yy-mm-dd',
onSelect: (formattedDate, date, inst) => {
if ($("#search_legs_1_hotel_date").length > 0) {
$('#search_legs_0_hotel_date').datepicker().data('datepicker').update('maxDate', date);
$('#search_legs_1_hotel_date').datepicker().data('datepicker').update('maxDate', date);
$('#search_legs_1_hotel_date').datepicker().data('datepicker').datepicker("setDate", date);
}
}
})
Everything seems to be in order, but the default date is not highlighted. Is there a specific setting required for this?
Thank you for your assistance.