diff options
| author | Sean King <seanking2919@protonmail.com> | 2022-08-01 21:25:08 -0600 |
|---|---|---|
| committer | Sean King <seanking2919@protonmail.com> | 2022-08-01 21:25:08 -0600 |
| commit | b70d50407cef26926635b1b47131c01e597fcfc6 (patch) | |
| tree | 04656a434e46d3c39bcf841e3816c030bb365941 /src/components/timeago | |
| parent | 232cc72df8352db15ac3e6b11c1f9c5908069771 (diff) | |
Refresh the relative time object for a Timeago component if the time changes
Diffstat (limited to 'src/components/timeago')
| -rw-r--r-- | src/components/timeago/timeago.vue | 7 |
1 files changed, 7 insertions, 0 deletions
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 |
