search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

How can we detect if the start or end of an event was changed?

Asked by Jens Stragier
11 days ago.

Hi,

we currently use the following code to detect if the start or end of an event was changed (important for our business logic).

var startTimeChanged = args.e.part.start.value != args.newStart.value;
var endTimeChanged = args.e.part.end.value != args.newEnd.value;

Is there any way we can detect it without doing a date compare? When we are using the DayPilot Scheduler in week-mode (cellDuration = 1440 + groupBy: "Week") somehow the startdate of the event gets changed even though we only are extending from the right side (changing the enddate).

Since we are using the resize "bars" on the left/right of an event, it should easily be possible to detect which one was handled?
Unless this is a bug and should/could easily be fixed?

Looking forward to your reply!

Answer posted by Dan Letecky [DayPilot]
11 days ago.

Hi Jens,

The e.part object is an internal structure that shouldn't be used for calculations. The e.part.start/end properties hold start/end for rendering purposes only - it won't always correspond to the defined start/end.

You should be able to detect the start/end change using e.start()/e.end():

var startTimeChanged = args.e.start() !== args.newStart 
var endTimeChanged = args.e.end() !== args.newEnd;
Comment posted by Jens Stragier
11 days ago.

Hi Dan,

Unfortunately this does not work. Both variables still come up as "true" even though i'm only changing the enddate of the event. When i switch back to day mode (cellDuration = 60), all is fine.

dp.cellDuration = 1440; ('week' mode)
dp.timeHeaders = [{ groupBy: "Week" }];
dp.snapToGrid = true;
dp.scale = "CellDuration"
dp.showNonBusiness = false;

Answer posted by Jens Stragier
11 days ago.

It ended up being some duplicate code in our file that was modifying the .start / .end properties for no good reason. So resolved, but would love a built-in way to detect what has changed :)

New Reply
This reply is
Your name (optional):