title: Setting Date format for JQuery date picker clears the initial date value
body: <p>I'm trying to set format for the date picker but it clears the default value in the field.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$(".date").datepicker();
  // While trying to format (the same format as mentioned above 'dd-mm-yy'), the field value is cleared on execution of below code
  $('.date').datepicker("option", "dateFormat", "dd-mm-yy");</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html&gt;
  
  &lt;head&gt;
    &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
    &lt;script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"&gt;&lt;/script&gt;
    &lt;link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
    &lt;!-- Kindly note that format of the value here is 'dd-mm-yy' --&gt;
    &lt;p&gt;Date: &lt;input class='date' type="text" value="31-12-2016"&gt;&lt;/p&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Already I have read through these posts
  |<a href="https://stackoverflow.com/questions/2427504/jquery-ui-datepicker-date-format-issue-with-initial-value">JQuery UI Datepicker date format issue with initial value</a>|<a href="https://stackoverflow.com/questions/10468547/why-does-constructing-a-jquery-ui-datepicker-clear-the-fields-value">Why does constructing a JQuery UI Datepicker clear the field's value?</a>|<a href="https://stackoverflow.com/questions/17292472/setting-option-on-jqueryui-datepicker-clears-the-textboxs-value">Setting 'option' on jqueryui DatePicker clears the textbox's value?</a></p>
  
  <p>All states that the existing value should match date picker's format which I'm trying to set. Looks like I'm clean in that.</p>
  
  <p>Can anyone help me out? Thanks.</p>