title: jquery datetime picker set minDate dynamic
body: <p>I guys i'm using a datetimepicker by trentrichardson.com.</p>
  
  <p>I have a form with two input fields : <strong>from</strong> and <strong>to</strong> and i want to be able to set dynamically a minDate to my "to" field  equal to the value of my "from" field.</p>
  
  <p>I know i should use a beforShow option but don't know how to implement the function.</p>
  
  <pre><code>$('.from,.to').datetimepicker({
  
      beforeShow: customRange
  
  });
  </code></pre>
  
  <p><strong>EDITED/SOLUTION</strong></p>
  
  <pre><code>function customRange(input) {   
  if (input.id == 'to') {     
  var x=$('#from').datepicker("getDate");
  $( ".to" ).datepicker( "option", "minDate",x ); 
  } 
  else if (input.id == 'from') {     
  var x=$('#to').datepicker("getDate");
  $( ".from" ).datepicker( "option", "maxDate",x ); 
  } } 
  </code></pre>