title: Carbon unexpected date-time format in Laravel
body: <p>I have problem with <code>Carbon</code> and HTML5 input <code>input[type=datetime-local]</code> because this input sends datatime in format <code>Y-m-d\TH:i</code> (eg. <code>2016-11-20T11:45</code>). </p>
  
  <p>I have method in my controller:</p>
  
  <pre><code>public function store(ModelStoreFormRequest $request) 
  {
      $model = new Model($request-&gt;all());
      $model-&gt;save();
      return redirect-&gt;action(/*...*/);
  }
  </code></pre>
  
  <p>And I get exception:</p>
  
  <pre><code>InvalidArgumentException in Carbon.php line 582: Data Missing
  1. in Carbon.php line 582
  2. at Carbon::createFromFormat('Y-m-d H:i:s', '2016-11-20T11:45') in HasAttributes.php line 709
  </code></pre>
  
  <p>So I have solved this problem by creating next function in my model:</p>
  
  <pre><code>public function setStartedAtAttribute($startedAt)
  {
      if( $startedAt instanceof Carbon ) {
          $this-&gt;attributes['started_at'] = $startedAt;
          return;
      }
  
      if( strpos($startedAt, 'T' ) ) {
          $this-&gt;attributes['started_at'] = Carbon::createFromFormat('Y-m-d\TH:i', $startedAt);
          return;
      }
  
      $this-&gt;attributes['started_at'] = Carbon::createFromFormat('Y-m-d H:i:s', $startedAt);
  }
  </code></pre>
  
  <p>But I do not like this solution, I wonder if there are more elegant solution? I am thinking to use <code>ModelStoreFormRequest::prepareForValidation()</code> method and there to check if format of date is: <code>Y-m-d\TH:i</code> to change datetime value to format: <code>Y-m-d H:i:s</code>, or maybe to use <code>Carbon::parse()</code> method like this:</p>
  
  <pre><code>protected function prepareForValidation() 
  {
      $input = $this-&gt;all();
      $input['started_at'] = \Carbon\Carbon::parse($input['started_at']);
      $this-&gt;replace($input);
  }
  </code></pre>
  
  <p>But I still do not know is this solution fine. I am trying to separate concerns and obligation of each class... What do you suggest? Any other more elegant solution or stick to the current one?</p>