useTimeAgo

Reactive time ago. Automatically update the time ago string when the time changes.

TimeAgo.vue
<script setup>
  import { useTimeAgo } from '@vueuse/core'
  const date = new Date(2000, 0, 1)
  const timeAgo = useTimeAgo(date)
</script>

<template>
  <div>
    <strong>
      {{ timeAgo }}
    </strong>
    since
    {{ date.toLocaleDateString() }}
  </div>
</template>
25 years ago since 1/1/2000