title: MomentJS invalid date
body: <p>I'm trying to convert a date string like 'DD-MM-YYYY', to 'YYYY-MM-DD'.
  Unfortunately I'm getting a invalid date.</p>
  
  <pre><code>  var startDate = $('.startDate').val();
    var endDate = $('.endDate').val();
  
    var newstartDate = moment(startDate).format( "YYYY-MM-DD");
    endDate = moment(endDate, "YYYY-MM-DD");
  
    console.log('startDate:',startDate)
    console.log('newstartDate:',newstartDate)
    console.log('endDate:',endDate)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/18pLN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/18pLN.png" alt="enter image description here"></a></p>
  
  <p>How could I get the output as: 2018-09-14 . / 2018-08-14 ?</p>