title: Laravel 5: How to validate datetime input from 4 input fields?
body: <p>I have a form which includes a deadline and the user should set the deadline in four input fields like this:</p>
  
  <pre><code>&lt;div class="form-group col-lg-3"&gt;
      {!! Form::label('year', 'Year', ['class' =&gt; 'control-label']) !!}
      {!! Form::selectYear('year',$year, $year +1, null , ['class' =&gt; 'form-control']) !!}
  &lt;/div&gt;
  &lt;div class="form-group col-lg-3"&gt;
      {!! Form::label('month', 'Month', ['class' =&gt; 'control-label']) !!}
      {!! Form::selectRange('month', 1, 12 , null , ['class' =&gt; 'form-control']) !!}
  &lt;/div&gt;
  &lt;div class=" form-group col-lg-3"&gt;
      {!! Form::label('day', 'Day', ['class' =&gt; 'control-label']) !!}
      {!! Form::selectRange('day', 1, 31 , null , ['class' =&gt; 'form-control']) !!}
  &lt;/div&gt;
  &lt;div class=" form-group col-lg-3"&gt;
      {!! Form::label('hour', 'Hour', ['class' =&gt; 'control-label']) !!}
      {!! Form::selectRange('hour', 6, 23 , null , ['class' =&gt; 'form-control']) !!}
  &lt;/div&gt;
  </code></pre>
  
  <p>In a formRequest, I'm compiling these four fields into a deadline. So my formRequest is like this:</p>
  
  <pre><code>public function rules()
      {
          $this-&gt;prepInput();
          return [
  
          ];
      }
      public function prepInput(){
          $input=$this-&gt;all();
          ...
          $input['deadline']=$this-&gt;prepDeadline($input['hour'], $input['month'], $input['day'], $input['year']);
          ...
          $this-&gt;replace($input);
      }
  
  
      public function prepDeadline($hour,$month,$day, $year){
  
              $time = jDateTime::mktime($hour, 0, 0, $month, $day, $year);
              return $deadline = strftime("%Y-%m-%d %H:%M:%S", $time);        
      }
  </code></pre>
  
  <p>The deadline is a Jalali datetime and I need to check if the user have selected a valid date or not (e.g. 1394/12/31 is not a valid date). The <code>jDatetime</code> package has a <code>checkdate</code> method which works exactly like php <code>checkdate</code>. Where and how can I validate the date in this formRequest and notify the user to select a valid date?
  In fact I need this validation to take place before the deadline is passed to <code>prepInput</code>.</p>