From 49c4d66bfb89497d1ae68d34a86c61d3ef4af295 Mon Sep 17 00:00:00 2001
From: Alex ORLUC <alex.orluc@maarch.org>
Date: Wed, 6 Nov 2019 14:38:16 +0100
Subject: [PATCH] fix timeAgo if current day

---
 src/frontend/plugins/timeAgo.pipe.ts | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/frontend/plugins/timeAgo.pipe.ts b/src/frontend/plugins/timeAgo.pipe.ts
index f0c6ba8fd91..ef2405f1e0e 100755
--- a/src/frontend/plugins/timeAgo.pipe.ts
+++ b/src/frontend/plugins/timeAgo.pipe.ts
@@ -32,6 +32,7 @@ export class TimeAgoPipe implements PipeTransform, OnDestroy {
 		month[10] = this.lang.novemberShort;
 		month[11] = this.lang.decemberShort;
 		let seconds = Math.round(Math.abs((now.getTime() - d.getTime())/1000));
+		let curentDayNumber = ('0' + now.getDate()).slice(-2);
 		let timeToUpdate = (Number.isNaN(seconds)) ? 1000 : this.getSecondsUntilUpdate(seconds) *1000;
 		this.timer = this.ngZone.runOutsideAngular(() => {
 			if (typeof window !== 'undefined') {
@@ -58,10 +59,10 @@ export class TimeAgoPipe implements PipeTransform, OnDestroy {
 			return minutes + ' ' + this.lang.minutes;
 		} else if (minutes <= 90) {
 			return this.lang.oneHour;
-		} else if (hours <= 22) {
+		} else if (hours <= 24 && dayNumber === curentDayNumber) {
 			return hourNumber+':'+minuteNumber;
 			//return hours + ' heures';
-		} else if (hours <= 36) {
+		} else if (hours <= 24) {
 			return dayNumber+' '+ month[d.getMonth()];
 			//return 'un jour';
 		} else if (days <= 25) {
-- 
GitLab