title: How to validate date using DatePipe in Angular 5 app?
body: <p>I have bsDatepicker with bsConfig and I'm trying to validate it, to make sure it is with the right format. The problem is that bsDatepicker create a date in a different format so I can't validate it.</p>
  
  <p>The date string is:</p>
  
  <pre><code>Mon Apr 01 2019 19:05:36 GMT+1100 (Australian Eastern Daylight Time)
  </code></pre>
  
  <p>I'm trying to transform it using DatePipe like:</p>
  
  <pre><code>dateStr = this.datepipe.transform(date.toDateString(), 'MM/dd/yyyy');
  </code></pre>
  
  <p>What I'm getting is null. The expected result will be 04/01/2019.
  Any idea why the datepipe failed to transform?
  Thanks.</p>