title: Selected date is most of the time 01/01/0001 00:00:00
body: <p>When selecting the date and time with a custom DateTimePicker (<a href="https://tempusdominus.github.io/bootstrap-4/Usage/" rel="nofollow noreferrer">https://tempusdominus.github.io/bootstrap-4/Usage/</a>). When the submit button is clicked 9 out of 10 times the date and time is this :</p>
  
  <pre><code>01/01/0001 00:00:00
  </code></pre>
  
  <p>Code on the Razor page :</p>
  
  <pre><code>        &lt;div class="form-group row"&gt;
              &lt;label class="col-sm-2 col-form-label"&gt;Date and time :&lt;/label&gt;
              &lt;div class="col-sm-4"&gt;
                  &lt;div class="input-group date" id="datetimepicker1" data-target-input="nearest"&gt;
                      &lt;input asp-for="IncidentDateAndTime" type="text" class="form-control datetimepicker-input" data-target="#datetimepicker1" /&gt;
                      &lt;div class="input-group-append" data-target="#datetimepicker1" data-toggle="datetimepicker"&gt;
                          &lt;div class="input-group-text"&gt;&lt;i class="fa fa-calendar"&gt;&lt;/i&gt;&lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  </code></pre>
  
  <p>The script on the same page :</p>
  
  <pre><code> $(function () {
      $('#datetimepicker1').datetimepicker();
   });
  </code></pre>
  
  <p>The imports on the same page :</p>
  
  <pre><code>&lt;script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"&gt;&lt;/script&gt;
  &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.0/moment-with-locales.js"&gt;&lt;/script&gt;
  &lt;script src="https://rawgit.com/tempusdominus/bootstrap-4/master/build/js/tempusdominus-bootstrap-4.min.js"&gt;&lt;/script&gt;
  &lt;link href="https://rawgit.com/tempusdominus/bootstrap-4/master/build/css/tempusdominus-bootstrap-4.min.css" rel="stylesheet" /&gt;
  &lt;link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"&gt;
  </code></pre>
  
  <p>When clicking on the button to select a date and time the current date and time is set :</p>
  
  <p><a href="https://i.stack.imgur.com/PjLOs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PjLOs.png" alt="enter image description here"></a></p>
  
  <p>If this is set the value is this when I submit :</p>
  
  <pre><code>01/01/0001 00:00:00 
  </code></pre>