title: how to handle deprecation warning in momentjs
body: <p>I want to use momentjs to check for invalid date/time strings:</p>
  
  <pre><code>var invalid = '2017-03-18 23;00;00';
  if (moment(invalid).isValid()) {
    return 'valid date'
  }
  </code></pre>
  
  <p>This (correctly) throws a stacktrace with the familiar 'Deprecation warning: value provided is not in a recognized RFC2822 or ISO format......'</p>
  
  <p>But even if I add a try/catch:</p>
  
  <pre><code>try {
    var invalid = '2017-03-18 23;00;00';
    if (moment(invalid).isValid()) {
      return 'valid date'
    }
  catch (err) {
    throw Error ('invalid date format');
  }
  </code></pre>
  
  <p>the stacktrace is still printed.
  What do I need to do to avoid the stacktrace from being printed?</p>
  
  <p>I've searched all similar questions on StackOverflow but they all try to solve a different problem (fixing the input or finding the correct syntax to parse the input).</p>
  
  <p>I using v2.18.1.</p>