From 702caa993cee90edcc7feaff129a710836e0de8a Mon Sep 17 00:00:00 2001 From: Evgeni B Date: Mon, 13 Feb 2023 15:01:12 +0300 Subject: [PATCH] fix(comment-item): comment time since formating has been fixed (#1998) (#2008) --- src/components/proposals/comment-item.vue | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/proposals/comment-item.vue b/src/components/proposals/comment-item.vue index e5aa4a5fa..227651ba0 100644 --- a/src/components/proposals/comment-item.vue +++ b/src/components/proposals/comment-item.vue @@ -93,8 +93,14 @@ export default { const day = date.getDateDiff(TODAY, created, 'days') const month = date.getDateDiff(TODAY, created, 'months') const year = date.getDateDiff(TODAY, created, 'years') + if (year > 0) { + if (month < 12) { + return `${month} month${month > 1 ? 's' : ''} ago` + } else { + return `${year} year${year > 1 ? 's' : ''} ago` + } + } - if (year > 0) return `${year} year${year > 1 ? 's' : ''} ago` if (month > 0) return `${month} month${month > 1 ? 's' : ''} ago` if (day > 0) return `${day} day${day > 1 ? 's' : ''} ago` if (hour > 0) return `${hour} hour${hour > 1 ? 's' : ''} ago`