Skip to content

Commit

Permalink
Datepicker range demo: Use public APIs. Fixes #8292 - Double Click on…
Browse files Browse the repository at this point in the history
… from date in Date range datepicker.
  • Loading branch information
scottgonzalez committed May 3, 2012
1 parent efe53f5 commit f6c0b71
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions demos/datepicker/date-range.html
Expand Up @@ -11,18 +11,20 @@
<link rel="stylesheet" href="../demos.css">
<script>
$(function() {
var dates = $( "#from, #to" ).datepicker({
$( "#from" ).datepicker({
defaultDate: "+1w",
changeMonth: true,
numberOfMonths: 3,
onSelect: function( selectedDate ) {
var option = this.id == "from" ? "minDate" : "maxDate",
instance = $( this ).data( "datepicker" ),
date = $.datepicker.parseDate(
instance.settings.dateFormat ||
$.datepicker._defaults.dateFormat,
selectedDate, instance.settings );
dates.not( this ).datepicker( "option", option, date );
$( "#to" ).datepicker( "option", "minDate", selectedDate );
}
});
$( "#to" ).datepicker({
defaultDate: "+1w",
changeMonth: true,
numberOfMonths: 3,
onSelect: function( selectedDate ) {
$( "#from" ).datepicker( "option", "maxDate", selectedDate );
}
});
});
Expand Down

0 comments on commit f6c0b71

Please sign in to comment.