Angular 2 using DatePipe to format date on TypeScript

in your app.module.ts file you need to import the DatePipe module

then under providers you need to include the DatePipe

In your component import it again

Use dependency injection so it available to component

this is how you actualy use it to format your date

In my case I actually had to populate the form controls.

Leave a comment