title: String dates comparison in javascript
body: <p>So, I have two variables and one function:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code> function addDays(date, days) {
      var result = new Date(date);
      result.setDate(result.getDate() + days);
      return result;
    }
    
   const dateToCompare=moment.utc(endDate).format('DD-MM-YYYY')
   const maximum=moment.utc(addDays(new Date(),14)).format('DD-MM-YYYY')</code></pre>
  </div>
  </div>
  </p>
  <p>However, I do not know how to compare them, since they are now formatted as strings, but at the same time new Date(dateToCompare) doesn't work.</p>
  <p>Can someone give me a hint?</p>