<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<style>
/* Custom CSS Styles */
.ui-widget-content .ui-state-default,
.ui-widget-header .ui-state-default,
.ui-button,
html .ui-button.ui-state-disabled:hover,
html .ui-button.ui-state-disabled:active {
background: 0 !important;
border: 0 !important;
color: #9c9c9c !important;
font-weight: bold;
text-align: center !important;
white-space: no-wrap;
font-size: 10px;
}
table {
border-collapse: collapse !important;
margin: 0;
}
.ui-datepicker-multi-2 .ui-datepicker-group {
width: 48%;
margin: 0 1%;
}
.ui-datepicker-multi .ui-datepicker-group table {
width: 100% !important;
}
/* Additional Styles */
.ui-datepicker-unselectable.ui-state-default {
display: none;
}
.ui-state-range {
background-color: #FBD2D3 !important;
color: #fff !important;
}
/* Other styles go here... */
</style>
<input type="text" id="flexibledates" />
<input type="text" id="flightdeparture" />
<script>
// JavaScript logic for datepicker functionality
$(function() {
// Datepicker setup for 'flexibledates' input field
$('#flexibledates').datepicker({
changeMonth: false,
numberOfMonths: 2,
dateFormat: 'D, d MM',
dayNamesMin: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
beforeShow: function(input, inst) {
insertMessageStartDate();
},
onSelect: function(selectedDate) {
var selectedDate = $("#flexibledates").datepicker("getDate");
if (selectedDate != null) {
$('#flightdeparture').datepicker('option', 'minDate', selectedDate).datepicker('refresh');
}
}
});
// Datepicker setup for 'flightdeparture' input field
$('#flightdeparture').datepicker({
changeMonth: false,
numberOfMonths: 2,
dateFormat: 'D, d MM',
dayNamesMin: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
beforeShow: function(input, inst) {
insertMessageEndDate();
},
onSelect: function(selectedDate) {
$('#flexibledates').datepicker('option', 'maxDate', $(this).datepicker('getDate'));
}
});
// Functions to insert messages for start and end dates
function insertMessageStartDate(message) {
clearTimeout(insertMessageStartDate.timer);
if ($('#ui-datepicker-div .ui-datepicker-calendar .ui-state-default').is(':visible')) {
$('.ui-state-default').after('<span class="lowTicketValue">' + 45555 + '</span>');
} else {
insertMessageStartDate.timer = setTimeout(insertMessageStartDate, 10);
}
}
function insertMessageEndDate(message) {
clearTimeout(insertMessageEndDate.timer);
if ($('#ui-datepicker-div .ui-datepicker-calendar .ui-state-default').is(':visible')) {
$('.ui-state-default').after('<span class="lowTicketValue">' + 45555 + '</span>');
$("#ui-datepicker-div td").on({
mouseenter: function() {
$(this).prevAll("td:not(.ui-datepicker-unselectable)").addClass("highlight");
},
mouseleave: function() {
$("#ui-datepicker-div td").removeClass("highlight");
}
});
} else {
insertMessageEndDate.timer = setTimeout(insertMessageEndDate, 10);
}
}
});
</script>