title: jQuery DateTimePicker compare selected date with current date
body: <p>When a user selects a date from my DateTimePicker it has the date like 01/07/2021, when comparing to the current day to ensure it's not a date in the past, my check formats the date like 1/7/2021 and then my code throws the error.</p>
  <p>In this scenario it shouldn't throw an error as the dates are exactly the same, just for the additional 0's. What am I doing wrong?</p>
  <p>HTML -</p>
  <pre><code>                                &lt;div class=&quot;input-group date&quot; id=&quot;datetimepicker1&quot; data-target-input=&quot;nearest&quot;&gt;
                                      &lt;input type=&quot;text&quot; class=&quot;form-control datetimepicker-input&quot; data-target=&quot;#datetimepicker1&quot; /&gt;
                                      &lt;div class=&quot;input-group-append&quot; data-target=&quot;#datetimepicker1&quot; data-toggle=&quot;datetimepicker&quot;&gt;
                                          &lt;div id=&quot;dateTime&quot; class=&quot;input-group-text&quot;&gt;&lt;i class=&quot;fa fa-calendar&quot;&gt;&lt;/i&gt;&lt;/div&gt;
                                      &lt;/div&gt;
                                  &lt;/div&gt;
  </code></pre>
  <p>JQuery -</p>
  <pre><code>    //create datetimepicker
      $(function () {
          $('#datetimepicker1').datetimepicker({
              sideBySide: true,
              format: 'L',
              // restrict past dates being selected
              minDate: new Date()
          });
      });
  
  
          var dateTime = $(&quot;#datetimepicker1&quot;).data().date;
  
          // get current Date to check against user input
          var currDate = new Date();
          var dd = currDate.getDate();
          var mm =  currDate.getMonth()+1;
          var yyyy = currDate.getFullYear();
          currDate = mm + '/' + dd + '/' + yyyy;
  
          // check if user date is in the past. If in past then throw error &amp; fail.
          if (dateTime &lt; currDate)
          {
              // throw error
              alert('Error - Invalid Date. All dates must be either in the present or future.')
              $(&quot;#datetimepicker1&quot;).datetimepicker(&quot;clear&quot;);
              return false;
          }
  </code></pre>