title: How to validate date with Moment.js to a specified format?
body: <p>I am unable to find an existing question/answer on how to validate a date input using moment.js to ensure that it is in this format, "2017-12-31T23:59:59Z". </p>
  
  <p>Given that I've got a date as a string, "2017-12-31T23:59:59Z", how can validate that the date string is strictly in the format specified, "YYYY-MM-DDThh:mm:ssZ".</p>
  
  <p>I've tried the following and it does not seem to work for me.</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>var dateTime = "2017-12-31T23:59:59Z";
  var utc = moment(dateTime, "YYYY-MM-DDThh:mm:ssZ", true)
  var isUTC = utc.isValid(dateTime);
  
  console.log(isUTC);</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"&gt;&lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Could anyone please provide a couple of examples?</p>
  
  <p>Thanks in advance
  -R</p>