diff --git a/src/app/pipes/date-ago.pipe.ts b/src/app/pipes/date-ago.pipe.ts index 62e236c..2283c63 100644 --- a/src/app/pipes/date-ago.pipe.ts +++ b/src/app/pipes/date-ago.pipe.ts @@ -22,12 +22,14 @@ export class DateAgoPipe implements PipeTransform { }; let counter; for (const i in intervals) { + const number = (seconds / intervals[i]).toFixed(1); counter = Math.floor(seconds / intervals[i]); + if (counter > 0) if (counter === 1) { - return counter + ' ' + i + ''; // singular (1 day ago) + return number + ' ' + i + ''; // singular (1 day ago) } else { - return counter + ' ' + i + 's'; // plural (2 days ago) + return number + ' ' + i + 's'; // plural (2 days ago) } } }