Human Readable Timestamp Component – moments-ago

Install & Download:

npm install vue-moments-ago

Description:

moments-ago is a Vue.js component that converts the timestamp into a human-readable format like xx days ago.

How to use it:

1. Import and register the moments-ago component.

import VueMomentsAgo from 'vue-moments-ago'
export default{
  components: {
    VueMomentsAgo
  }
}

2. Specify the Datatime (ISO 8601) in the moments-ago component. That’s it.

<vue-moments-ago 
  date="2020-06-08T21:22:22.285Z" 
/>

3. Add prefix & suffix to the result.

<vue-moments-ago 
  date="2020-06-08T21:22:22.285Z" 
  prefix="Updated: " 
  suffix="ago"
/>

Add Comment