From eefbeee325c81f3ed02e8519da5271392ae4fba4 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Thu, 20 Jul 2023 13:25:18 +0300 Subject: [PATCH] Show project update when a user is loggedin and fix condition if difference of dates is equal to 12 months. --- src/app/app.component.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 0ba528d..2f0cbaa 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -241,18 +241,19 @@ export class AppComponent implements OnInit, OnDestroy { } public setProjectUpdate(stakeholder: Stakeholder) { - if(stakeholder?.projectUpdateDate) { + if(stakeholder?.projectUpdateDate && this.user) { let today = new Date(); let date = new Date(stakeholder.projectUpdateDate); let months = (today.getFullYear() - date.getFullYear())*12 + (today.getMonth() - date.getMonth()); - console.log(months) - if(months > 12) { + if(months >= 12) { this.projectUpdate = 'danger'; } else if (months > 6 && months < 12) { this.projectUpdate = 'warning'; } else { this.projectUpdate = null; } + } else { + this.projectUpdate = null; } }