From b70d50407cef26926635b1b47131c01e597fcfc6 Mon Sep 17 00:00:00 2001 From: Sean King Date: Mon, 1 Aug 2022 21:25:08 -0600 Subject: [PATCH] Refresh the relative time object for a Timeago component if the time changes --- src/components/timeago/timeago.vue | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/components/timeago/timeago.vue b/src/components/timeago/timeago.vue index 2b487dfd..fce9605b 100644 --- a/src/components/timeago/timeago.vue +++ b/src/components/timeago/timeago.vue @@ -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