Below code is working fine for me. (OnClose of ValidFrom datepicker it should set minDate for ValidTo and viceversa)
$( "#validFrom" ).datepicker({
dateFormat : 'dd-M-yy',
changeMonth: true,
changeYear: true,
onClose: function( selectedDate ) {
$( "#validTo" ).datepicker( "option", "minDate", selectedDate );
}
});
$( "#validTo" ).datepicker({
dateFormat : 'dd-M-yy',
changeMonth: true,
changeYear: true,
onClose: function( selectedDate ) {
$( "#validFrom" ).datepicker( "option", "maxDate", selectedDate );
}
});
But after form submit, the functionality is not working. It is not setting mindate and maxDate as specified
Adding css and js being used:
<script th:src="@{/js/jsDatePick.min.1.3.js}"></script>
<link th:href="@{/css/jquery.ui.datepicker.css}" rel=" stylesheet" />
Javascript call on submit:
searchActionURL = function(obj) {
var atleastOneFilled = checkFields($("#searchForm"));
$('#searchValidate').val(atleastOneFilled);
$("#searchForm").attr("action", obj);
if(atleastOneFilled)
{
$("#searchResults").show();
}
else
{
alert('Please specify one search item');
return false;
}
};