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 () {
const dt = moment(this.value)
return {
fromNow: dt.fromNow(),
actual: dt.format('LLLL'),
fromNow: moment(this.value).fromNow(),
intervalId: null
}
},
computed: {
actual () {
return moment(this.value).format('LLLL')
}
},
mounted () {
this.intervalId = setInterval(this.updateFromNow, this.interval)
this.$watch('value', this.updateFromNow)