Show project update when a user is loggedin and fix condition if difference of dates is equal to 12 months.

This commit is contained in:
Konstantinos Triantafyllou 2023-07-20 13:25:18 +03:00
parent 03fcd9b8ce
commit eefbeee325
1 changed files with 4 additions and 3 deletions

View File

@ -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;
}
}