0

Currently I am receiving a created task field in Unix epoch format in tasks component. And I would like to calculate how much time its been the task has created.

For example : if the task created 2 Hours/Days/Minutes ago : I want to display it like "Created 2 hours/Days/Minutes ago".

what would be the easiest way to do this in Angular?

DLV
  • 553
  • 2
  • 6
  • 17

1 Answers1

0

There is a javascript library called moment.js. It can handle and formatting times.

It's as easy as moment.unix(yourUnixEpochTime).fromNow()

https://momentjs.com

Jack
  • 569
  • 2
  • 11
  • The library looks good but is there any other way without a third party library. The libraries within angular? – DLV Aug 11 '20 at 23:28