title: SetDate on jquery Datepicker onClose does not change value
body: <p>i have a table and each row has a datepicker. Datepickers are only selecting months and on close i set the first day of the month except if this day is before the minDate so i want to set minDate there. </p>
  
  <p>SetDate function does not work. My log gives me that properDate is set correctly but when i pass it in the setDate the result does not change and somehow it is stack to first Day of the month. What am i missing?</p>
  
  <pre><code>    function initDatepickerSchedule(){  
  
          $(".datepickerSchedule").each(function(){
  
              $(this).datepicker({
                  showOn: "both",
                  changeMonth: true,
                  changeYear: true,
                  dateFormat: "yy-mm-dd",
                  minDate: scheduleTaskMinDate(),
                  maxDate: scheduleTaskMaxDate($(this).closest("tr").find(".ScheduledTaskQtyInput").val(),$(this).closest("tr").find(".ScheduledTaskCompletedQtyInput").val()),
                  showButtonPanel: true,  
                  onClose: function(dateText, inst) { 
                      function isDonePressed(){
                         return $('#ui-datepicker-div').html().indexOf('ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all ui-state-hover') &gt; -1;
                      }
  
                      if (isDonePressed()){
                          var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
                          var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
                          var properDate=new Date(year, month, 1);
                          var minDate=$(this).datepicker("option","minDate");                  
                          console.log(properDate);// 2019-12-1
                          console.log(minDate);//2019-12-2
                          console.log(properDate&lt;minDate);// true
                          if(properDate&lt;minDate){
                              properDate=minDate;
                          }
                          console.log("before set");
                          console.log(properDate===minDate);//true
                          console.log(properDate);//2019-12-2
  
                          $(this).datepicker("setDate",properDate);
                          console.log($(this).datepicker("getDate"));//2019-12-1
                          var coNo=$(this).closest("tr").find(".changeOrderNoInput").val();
                          $(this).closest("tr").find(".ScheduledTaskVersion").val(studyTaskScheduleVersion($(this).datepicker("getDate"),coNo));
                          $("#SubmitScheduleDistButton").prop('disabled', true).prop('title',"Validate without Errors to Unlock");
                      }
                  }               
              }).focus(function(){
                  $(".ui-datepicker-calendar").hide();
                  $(this).attr("autocomplete","off");
              });
          });
      }
  </code></pre>