Consider the following use case where Both Event A and Event B should not be scheduled before 2020-03-23 12:02 AM and after 2020-03-23 4:00 PM
To achieve this I have used getDateConstraints https://bryntum.com/products/schedulerpro/docs/api/Scheduler/view/SchedulerBase#config-getDateConstraints
if you play with the zoom levels, and try to drag event A to have the end datetime to the latest datetime (which is 4:00 pm in this case), Event A will auto adjust itself to have end datetime as 2020-03-23 3:53 PM (based on the zoom level).
Similarly with the start date, if you drag event A to the earliest datetime (which is 12:02 AM), Event A will auto adjust it's start datetime to 2020-03-23 12:00 AM (based on the zoom level).
Can you help me with this? How can I stop the Events from auto adjusting itself to a random datetime? I believe the events auto adjust itself to nearest 15/30 minute interval.
P.S. In some cases, the events do not respect the constraints and auto adjust itself after the latest date or/and before the earliest date.
Code for the above use case:
import { SchedulerPro } from '../../build/schedulerpro.module.js?465031';
import shared from '../_shared/shared.module.js?465031';
const scheduler = new SchedulerPro({
project: {
"resources": [{
"id": 1,
"name": "Resource 1",
},
{
"id": 2,
"name": "Resource 2",
},
],
"events": [{
"id": 1,
"name": "Event A",
"startDate": "2020-03-23T03:00",
"duration": 111,
"durationUnit": "minutes",
},
{
"id": 2,
"name": "Event B",
"startDate": "2020-03-23T01:00",
"duration": 97,
"durationUnit": "minutes",
},
],
"assignments": [{
"id": 1,
"event": 1,
"resource": 1
},
{
"id": 2,
"event": 2,
"resource": 2
}
]
},
appendTo: 'container',
startDate: '2020-03-23',
endDate: '2020-03-24',
rowHeight: 40,
barMargin: 10,
viewPreset: 'hourAndDay',
getDateConstraints() {
const start = new Date("2020-03-23 12:02 AM");
const end = new Date("2020-03-23 4:00 PM");
return {
start,
end,
};
},
features: {
eventDrag: {
constrainDragToResource: false,
unifiedDrag: false,
showExactDropPosition: true,
},
},
timeResolution: {
unit: 'minute',
increment: 1
},
shiftIncrement: 1,
shiftUnit: 'minute',
columns: [
{
text: 'Resource',
width: 150,
field: 'name',
htmlEncode: false,
}
],
});