I want to filtering the date between two textbox, my problem is when I pick the date on the second box, it doesnt include the date that i choose.
the code for textbox
<label for="from">From</label>
<input type="text" id="from" />
<label for="to">To</label>
<input type="text" id="to" />
for script the datepicker
//function for datepicker and date range
$(function() {
$( "#from" ).datepicker({
defaultDate: "+1w",
changeMonth: true,
numberOfMonths: 1,
onSelect: function( selectedDate ) {
$( "#to" ).datepicker( "option", "minDate", selectedDate );
}
});
$( "#to" ).datepicker({
defaultDate: "+1w",
changeMonth: true,
numberOfMonths: 1,
onSelect: function( selectedDate ) {
$( "#from" ).datepicker( "option", "maxDate", selectedDate );
}
});
});
updated
$from = new Date(Date.parse($("#from").datepicker('getDate')));
$to = new Date(Date.parse($("#to").datepicker('getDate')));
this is how it defined
You should just access the value directly: