Skip to content

Commit

Permalink
fix(comment-item): comment time since formating has been fixed (#1998) (
Browse files Browse the repository at this point in the history
  • Loading branch information
evgenibir authored Feb 13, 2023
1 parent ee2204e commit 702caa9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/components/proposals/comment-item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down

0 comments on commit 702caa9

Please sign in to comment.