title: How to handle date input in Laravel
body: <p>I'm working on an app that allows the user to edit several dates in a form. The dates are rendered in the European format (DD-MM-YYYY) while the databases uses the default YYYY-MM-DD format. </p>
  
  <p>There are several ways to encode/decode this data back and forth from the database to the user, but they all require a lot of code:</p>
  
  <ul>
  <li>Use a helper function to convert the date before saving and after retrieving (very cumbersome, requires much code)</li>
  <li>Create a separate attribute for each date attribute, and use the <code>setNameAttribute</code> and <code>getNameAttribute</code> methods to decode/encode (also cumbersome and ugly, requires extra translations/rules for each attribute)</li>
  <li>Use JavaScript to convert the dates when loading and submitting the form (not very reliable)</li>
  </ul>
  
  <p>So what's the most efficient way to store, retrieve and validate dates and times from the user? </p>