Refresh the relative time object for a Timeago component if the time changes

This commit is contained in:
Sean King 2022-08-01 21:25:08 -06:00
parent 232cc72df8
commit b70d50407c
No known key found for this signature in database
GPG Key ID: 510C52BACD6E7257
1 changed files with 7 additions and 0 deletions

View File

@ -34,6 +34,13 @@ export default {
unmounted () {
clearTimeout(this.interval)
},
watch: {
time (newVal, oldVal) {
if (oldVal !== newVal) {
this.refreshRelativeTimeObject()
}
}
},
methods: {
refreshRelativeTimeObject () {
const nowThreshold = typeof this.nowThreshold === 'number' ? this.nowThreshold : 1