Ionic time-ago npm package or pipe

hi everybody, i’m bulding a ionic chat application but i need help to implement time-ago in the chat views? thanks

date-fns distanceInWordsToNow.

thanks for the reply, but can i use

Yes, that works fine.

how did you use this?

??? There are code examples on the page you linked.

{{data.createdAt| dfnsFormat : 'YYYY/MM/DD'}}

where i’m wrong?

You need to create a pipe and use the date-fns function as the core function of the pipe. Standard Angular. If you don’t know how to create a pipe, take a look at the code examples in official Angular or Ionic docs and projects. Might want to start with the pipe in the lazy-loading example project, if you lazy-load pages.

Thanks, that works now.