title: ERROR TypeError: Cannot read property 'split' of null in angular custom pipe
body: <p>I am getting this error ERROR TypeError: Cannot read property 'split' of null error while using this angular pipe and here is the code.</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>import { Pipe, PipeTransform } from '@angular/core';
  
  @Pipe({
    name: 'fullDate'
  })
  export class DatePipe implements PipeTransform {
  
    transform(value:any ) {
      const dateArray = value.split('-');
      const date = dateArray[2].substr(0, 1) === '0' ? dateArray[2].substr(1, 1) : dateArray[2];
      const months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
    
      return `${date} ${months[dateArray[1] - 1]} ${dateArray[0]}`;
    }
  
  }</code></pre>
  </div>
  </div>
  </p>
  
  <blockquote>
    <p>{{ lorem?.lorem_date | fullDate }}</p>
  </blockquote>
  
  <p><a href="https://i.stack.imgur.com/Or11x.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Or11x.png" alt="enter image description here"></a></p>