title: Issue with jQuery datepicker beforeShow date format
body: <p>I have intergrated jQuery datepicker, date format I want in the datepicker text box is e.g. "Fri, Aug 4", this is all working.</p>
  
  <p>Problem: When I open the calendar with date ("Fri Aug 4") in the text box , this date gets highlighted in the calendar but the date format in the calendar text box is changed to "08/04/2017".</p>
  
  <p>I always want the date to be shown in my own format in the text box in any context, but that's not happening. I have "onSelect" function which formats the selected date and shows up properly in the text box. The issue is when the calendar opens. Below is my "beforeShow" code. Can someone help me in fixing this?</p>
  
  <pre><code>$("#exercise_date").datepicker({
      beforeShow: function(input, inst) {              
          var objStartDate = new Date( $("#exercise_date").data("selectedDate") );
          var customFormatDateStr = dayName[objStartDate.getDay()]+", "+months[objStartDate.getMonth()]+" "+objStartDate.getDate();
          $("#exercise_date").val( customFormatDateStr );
          $(this).datepicker("setDate", new Date($("#exercise_date").data("selectedDate")));              
      },
      enableOnReadonly: true,
      minDate: new Date( '2017-06-01T08:30:00Z' ),
      maxDate: new Date(),
      autoclose: true,
      hideIfNoPrevNext: true,
      onSelect: function(selectedDate){
          var displayDateObj = new Date( selectedDate );
          var customFormatDateStr = dayName[displayDateObj.getDay()]+", "+months[displayDateObj.getMonth()]+" "+displayDateObj.getDate();
          $("#exercise_date").val(customFormatDateStr);
          $("#exercise_date").data("selectedDate",selectedDate);
      },
      onClose: function(input, inst) {
          var objStartDate = new Date( $(this).data("selectedDate") );
          var customFormatDateStr = dayName[objStartDate.getDay()]+", "+months[objStartDate.getMonth()]+" "+objStartDate.getDate();
          $("#exercise_date").val( customFormatDateStr );
      }
  });
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/tWyHp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tWyHp.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/w49Qy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/w49Qy.png" alt="enter image description here"></a></p>