commit: b70d50407cef26926635b1b47131c01e597fcfc6
parent 232cc72df8352db15ac3e6b11c1f9c5908069771
Author: Sean King <seanking2919@protonmail.com>
Date: Mon, 1 Aug 2022 21:25:08 -0600
Refresh the relative time object for a Timeago component if the time changes
Diffstat:
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git 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