title: Change formate date with custom pipe in Angular (without DatePipe)
body: <p>I need to change the date format depending on a chosen number, that is, creating a custom pipe that allows choosing from 1 to 4 and changing the date format.</p>
  <p>Number 1 should show this date format: 25092021</p>
  <p>Number 2: 25 09 2021</p>
  <p>Number 3: 09/25/2021</p>
  <p>Number 4: 2021-09-25</p>
  <p>The initial format is this: 2022-03-07T00:00:00.000Z</p>
  <p>The code that has occurred to me is this but I don't know how to tell it the transformation of the date.</p>
  <pre><code>@Pipe({
    name: 'formatDate',
  })
  export class FormatDatePipe implements PipeTransform {
    transform(value: Date, ...args: number[]): unknown {
      const [date] = args;
  
      switch (date) {
        case 1: {
          value.transform(date,'ddMMYYYY'); //this doesn't work
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4:
          break;
      }
  
      return value;
    }
  }
  </code></pre>
  <p>And HTML:</p>
  <pre><code>&lt;li&gt;&lt;strong&gt;Publication date: &lt;/strong&gt; {{post.publication_date | formatDate: 1 }}&lt;/li&gt;
  </code></pre>
  <p>Any idea how I can change the various formats?</p>