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:
parent
03fcd9b8ce
commit
eefbeee325
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue