I like the formatter, but I decided to just use moment directly which seems simpler and more straight-forward to me (I’m new to Vue, so I reserve the right to change my mind ).
I started with npm install --save moment
.
Then, in my .vue file,
<template>
<div>
The date was set {{moment(myDate).fromNow()}}
</div>
</template>
<script>
import moment from 'moment'
export default {
data () {
return {
myDate: null // Set to whatever
}
},
methods: {
moment
}
}
</script>
NOTE: This code isn’t tested (the date isn’t even actually set), but something very similar to it is working for me.