From 8703df27d5f61813e23676c92e8fab36bd94dd8c Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Sat, 12 Aug 2023 17:05:25 -0400 Subject: [PATCH] display years, fix #603 --- src/app/pipes/time-ago.pipe.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/app/pipes/time-ago.pipe.ts b/src/app/pipes/time-ago.pipe.ts index 256f1099..fb073d2d 100644 --- a/src/app/pipes/time-ago.pipe.ts +++ b/src/app/pipes/time-ago.pipe.ts @@ -30,7 +30,7 @@ export class TimeAgoPipe implements PipeTransform { const hours = minutes / 60; const days = hours / 24; // const months = days / 30.416; - // const years = days / 365; + const years = days / 365; if (seconds <= 59) { text = Math.round(seconds) + 's'; @@ -38,8 +38,10 @@ export class TimeAgoPipe implements PipeTransform { text = Math.round(minutes) + 'm'; } else if (hours <= 23) { text = Math.round(hours) + 'h'; - } else { + } else if (days < 365) { text = Math.round(days) + 'd'; + } else { + text = Math.round(years) + 'y'; } if (minutes < 1) {