Hi, We are working with Scheduler 4.0.2v and angular 10.
I need be able to change the start date of recurring time ranges.
When I create recurring time ranges, I put start date from where the range start, on some actions like zoom or scroll I get empty zones of time ranges, because the time span changed.
For solve this I listening on this event:
scheduler.on('timeAxisChange', this.timeAxisChange.bind(this));
Then I take the config start date of the event(this is the new start date of the time span) and call my update function.
timeAxisChange(event: {
config: IDateRange,
source: Scheduler,
type: string
}) {
this.updateRecurringTimeRanges(event.config.startDate, event.source);
}
And in this function I go over all recurring time ranges in the system, and update the start date by new span start date(in my case the minuts and hourse must be as the default time range).
updateRecurringTimeRanges(startDate: Date, scheduler: Scheduler) {
const allRecurringTimeRanges: TimeSpan[] = scheduler.features.timeRanges.store.getRange();
if (allRecurringTimeRanges.length !== 0) {
allRecurringTimeRanges.forEach((timeRange: TimeSpan) => {
// Set the start date by use new start date.
startDate.setHours(
(timeRange.startDate as Date).getHours(),
(timeRange.startDate as Date).getMinutes(),
0,
0
);
console.log(startDate);
timeRange.startDate = startDate.toISOString();
});
}
}
It is work but I get empty zone from recurring time ranges in previous start date.
What I am doing wrong?