title: jQuery UI Datepicker - Dynamic date formats on front end but static date format on back end?
body: <p>We have a request from many customers to make our datepickers reflect the date format they have chosen to use in our app. Unfortunately, we use datepickers a lot, so going to each one and making sure that the date is still properly parsed is a last resort.</p>
  
  <p>Right now I have translated the date format they chose into the corresponding date format for the datepicker, and simply set the default <code>dateFormat</code> to that.</p>
  
  <pre><code>&lt;?php
  // set default datepicker date format depending on their date format
  $phpToJsDateFormats = array(
      'j M Y' =&gt; 'd M yy',
      'Y-m-d' =&gt; 'yy-mm-dd',
      'm-d-Y' =&gt; 'mm-dd-yy',
      'd-m-Y' =&gt; 'dd-mm-yy',
      'n/j/Y' =&gt; 'm/d/yy',
      'j/n/Y' =&gt; 'd/m/yy',
      'F jS, Y' =&gt; 'MM d, yy',
  );
  $jqueryDateFmt = $phpToJsDateFormats[ $settings['Config']['format_date'] ];
  ?&gt;
  &lt;script type="text/javascript"&gt;
  $.datepicker.setDefaults({
      dateFormat: "&lt;?php echo $jqueryDateFmt ?&gt;"
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>To make this a simple fix, I was wondering if there was a way I could mask the actual value of the datepicker so the value we show the user is in their date format, but the value the datepicker actually submits is the default format that we already use. I'm thinking of something along the lines of a global form <code>onsubmit</code>, and something similar for forms submitted via AJAX, but I don't know. Maybe jQuery has something cool built into their datepicker that I don't know about.</p>
  
  <p>Any ideas would be greatly appreciated. Thanks!</p>