In this simple article I am going to demonstrate use of custom pipe in angular that displays given date into date ago format.

What really are pipes in Angular?

Well according to angular.io pipe are nothing but functions you can use in template expressions to accept an input value and return a transformed value.

Here,I am particular interested in usage of date pipe and angular provide some handy date pipes,some of them are,

{{date | date:’mediumDate’}}

{{date | date:’short’}}

{{date | date:’long’}}

{{date | date:’full’}}

{{date | date:’shortDate’}}.

To demonstrate use of pipes provided by angular let’s write some code.

pratik pokharel

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store