It looks like the DayPilot
object is not what you expect inside the callback. But that is not normal behavior, it should remain the same.
You can try the following to debug the issue:
1. Try printing the DayPilot
object to console and inspect it:
this.ref.onClose.subscribe((result: { newStart: Date }) => {
if (result) {
console.log("DayPilot", DayPilot);
let oldDate = new DayPilot.Date();
console.log(oldDate);
// this.eventService.handleOnEventEditAngular(event, result.newStart, this.scheduler);
}
});
If you see the actual object, you may be able to find the problem. You could see this exception if you override the DayPilot
object somewhere:
DayPilot = {};
2. Store the DayPilot
object in a special variable. This doesn’t fix the source of the problem but it may be a workaround.
showEditEventDialog(event: DayPilot.Event) {
let someDate = new DayPilot.Date();
const DayPilotRef = DayPilot;
console.log(someDate);
this.ref = this.openDialog(EditOrderDialog, header, {
event: event,
});
this.ref.onClose.subscribe((result: { newStart: Date }) => {
if (result) {
let oldDate = new DayPilotRef.Date();
console.log(oldDate);
// this.eventService.handleOnEventEditAngular(event, result.newStart, this.scheduler);
}
});
}