title: jQuery DatePicker in combination with fullcalendar and jQuery dialog, mindate not working
body: <p>I have a form in my html code that is made into a popup using jQuery dialog, in this form I have an input field for 'enddate' that uses a jQuery DatePicker to enter data.</p>
  
  <p>I am trying to set the mindate of the jQuery datepicker to the date that is clicked on fullcalendar (the hidden field that has the clicked date gets filled in properly but for some reason the datepicker mindate is not working)</p>
  
  <p>Form: </p>
  
  <pre><code>&lt;form id="logform" enctype="multipart/form-data" action="calendar"  method="post"&gt; 
                          &lt;select name='logoption' id='logoption' form="logform"&gt;  
                              &lt;option value="0"&gt; Select logtype &lt;/option&gt;
                              &lt;?php
                              //SQL in laravel style to get log types from database
                              $logtypes = DB::table('time_log_types')-&gt;get();
  
                              foreach ($logtypes as $logtype) {
                                  echo ' &lt;option value="' . $logtype-&gt;id . '"&gt;' . $logtype-&gt;logtype . '&lt;/option&gt;';
                              }
                              ?&gt;
                          &lt;/select&gt;
  
                          &lt;div id="illness" style="display:none"&gt;
                              &lt;p&gt;End date: &lt;input type="text" name="enddate" id="enddate"&gt;&lt;/p&gt; &lt;!-- this one is not getting the date as mindate --&gt;
                              &lt;input type="hidden" name="MAX_FILE_SIZE" value="30000" /&gt;
                              &lt;p&gt;Doctor's note: &lt;input type="file" name="doctorsnote" id="doctorsnote"/&gt;&lt;/p&gt;                                            
                          &lt;/div&gt;
  
                          &lt;input type="button" value="submit" id="submitbutton" style="display:none" onclick="submit()" /&gt;
                          &lt;input type="hidden" name="_token" value="&lt;?php echo csrf_token(); ?&gt;"&gt;
                          &lt;input type='hidden' name='logdate' id='logdate'&gt; &lt;!-- this one gets the proper date --&gt;
                      &lt;/form&gt;
  </code></pre>
  
  <p>Javascript:</p>
  
  <pre><code>$('#calendar').fullCalendar({
              //calendar options here              
  
                      dayClick: function(date, jsEvent, view) {
                      //to get date use date.format());
                      //POPUPCODE START
  
                      $('#logdate').val(date.format());
                      $( "#enddate" ).datepicker({
                            mindate: new Date(date.format()) //this piece of code isn't working
                            ,dateFormat: 'dd-mm-yy'
                          });                    
                      $("#somediv").load().dialog(
                      {   //Set options for the dialog here
                      modal: true,
                              autoResize:true,
                              maxWidth: 600,
                              minWidth: 500
                      });
                              //POPUPCODE END
                              var myCalendar = $('#calendar');
                              myCalendar.fullCalendar();
                              var myEvent = {
                              title: "Work 7.6h",
                                      allDay: true,
                                      start: date,
                                      end: date
                      };
                              myCalendar.fullCalendar('renderEvent', myEvent, true);
                      },
                      eventClick: function(calEvent, jsEvent, view) {
                      var myCalendar = $('#calendar');
                              myCalendar.fullCalendar('removeEvents', calEvent._id);
                      }
              });
  </code></pre>
  
  <p>EDIT: I got it to work by doing this (code snippet):</p>
  
  <pre><code> dayClick: function(date, jsEvent, view) {
                      //to get date use date.format());
                      //POPUPCODE START
                      $mindate = date.format('DD-MM-YY');
                      alert($mindate);
                      $('#logdate').val(date.format());
                      $( "#enddate" ).datepicker({
                             dateFormat: 'dd-mm-yy'
                          });  
                      $("#enddate").datepicker('option', 'minDate', $mindate);
  </code></pre>
  
  <p>But now my mindate is off by 2 days, let's say I clicked the 18th of may (today), that would make my mindate on top of my dialog screen 18-05-2015 and the same would appear in my hidden field, but the mindate on my jquery datepicker becomes 16-05-2015</p>