So I've been adapting my code to the code of other team, but I'm getting from an event emitter old information.
In this function:
addEvent(event?: MatDatepickerInputEvent<Date>) {
if (typeof event !== 'undefined') {
this.refDate = event.value;
this.refDate = new Date(this.refDate);
this.startDate = new Date(this.refDate);
} else if (typeof this.globals.contextDate === 'undefined') {
this.refDate = new Date();
this.refDate = new Date(this.refDate.getFullYear(), this.refDate.getMonth(), 0);
this.startDate = new Date(this.refDate);
} else {
this.refDate = this.globals.refDate;
this.startDate = new Date(this.refDate);
}
this.refDate.setHours(20);
const dateStr = this.refDate.toISOString().substring(0, 10);
this.globals.contextDate = dateStr;
this.globals.refDate = this.refDate;
// Atualiza o estado dos processos atraves da funcao do dashboard
this.getProcessState(dateStr);
// Transmite estados para os filhos
this.refDateChange.emit({
processClasses: this.processClasses,
refDate: this.refDate
});
this.startDate.setMonth(this.refDate.getMonth());
return this.startDate;
}
Detects when the datepicker changed It's value and is supposed to emit the newer information after that. But when I receive the info on the other component, the map object bring the old information.
When I console log:
this.captoolsComp.refDateChange.subscribe(data => {
this.processClasses = data.processClasses;
console.log(this.processClasses)
});
I shows this:
So you can see that the value of the key "Universo" (for example) it's not the same. What can I do to solve this?
Thank you so much.