check-in and check-out with ui picker?

check-in and check-out with ui picker?

Hi, I started using ui picker, but I would like to use 2 of them for recive a check-in and check-out date... the problem is that the second calendar has to have all the dates before the selected date in the calendar 1 blocked, and I just cannot do it!!!! I am using something like this

     <script>
           $(document).ready(function() {
           $("#datepicker").datepicker({minDate: 0, maxDate: '+1Y+6M'});
           $("#datepicker2").datepicker();   
            $("#datepicker2").focus(function(){
             var fecha = $('input#datepicker').val();
             
             $("#datepicker2").datepicker({minDate: '0' , maxDate: '+1Y+6M'});
          });
         
          });     
           </script>

I have wrote in minDate 0 but I actually wanna set there the value of "fecha", but seems like it cannot accept a variable in the way MM/DD/YYYY , and that is the way they are managing the date!! so, big problem for me, anyone know how I could fix that problem?