npm install vue-timy
import Vue from 'vue';
import timy from 'vue-timy';
// Use vue-timy
Vue.use(timy);
import Vue from 'vue';
import timy from 'vue-timy';
//The following options can be overridden.
var options = {
justNow: "Just now",
aFewSecondsAgo: "A few seconds ago",
secondsAgo: "seconds ago",
aMinuteAgo: "A minute ago",
minutesAgo: "minutes ago",
anHourAgo: "An hour ago",
hoursAgo: "hours ago",
aDayAgo: "A day ago",
daysAgo: "days ago",
aWeekAgo: "A week ago",
weeksAgo: "weeks ago",
aMonthAgo: "A month ago",
monthsAgo: "months ago",
aYearAgo: "A year ago",
yearsAgo: "years ago"
};
// Use vue-timy with custom formats
Vue.use(timy, options);
<template>
<timy :date="theDate" />
</template>
<script>
export default {
data() {
return {
theDate: new Date()
};
}
};
</script>