Update tooltip on date changed

Bound long date to computed property (addresses #15 )
This commit is contained in:
Daniel J. Summers 2018-06-14 18:21:14 -05:00
parent 650bda6bc5
commit 67cdd5a9b0

View File

@ -20,13 +20,16 @@ export default {
} }
}, },
data () { data () {
const dt = moment(this.value)
return { return {
fromNow: dt.fromNow(), fromNow: moment(this.value).fromNow(),
actual: dt.format('LLLL'),
intervalId: null intervalId: null
} }
}, },
computed: {
actual () {
return moment(this.value).format('LLLL')
}
},
mounted () { mounted () {
this.intervalId = setInterval(this.updateFromNow, this.interval) this.intervalId = setInterval(this.updateFromNow, this.interval)
this.$watch('value', this.updateFromNow) this.$watch('value', this.updateFromNow)