How to use angular pipe data formatter in component or service? Here is short example how you can easily achieve this:
Just make new instance of DatePipe class and use the method transform:
Just make new instance of DatePipe class and use the method transform:
const formatDate = new DatePipe('en').transform(myDate, 'dd-MM-yyyy');
Another way would be to use predefined angular method:
formatDate(data.created_at, 'shortDate', 'en')
more info you can find here:
https://floyk.com/en/app/post/edit/how-to-use-angular-pipe-in-component-or-service