]> source.dussan.org Git - jquery-ui.git/commitdiff
Datepicker range demo: Use public APIs. Fixes #8292 - Double Click on from date in...
authorScott González <scott.gonzalez@gmail.com>
Thu, 3 May 2012 13:04:52 +0000 (09:04 -0400)
committerScott González <scott.gonzalez@gmail.com>
Thu, 3 May 2012 13:04:52 +0000 (09:04 -0400)
demos/datepicker/date-range.html

index f939e8e938547cb62213a0a310257a7bec18fcc9..09ebba8427a366d32480d362c1d8cfa1296b914d 100644 (file)
        <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 );
                        }
                });
        });