Hi Benjamin,
Greetings from Syncfusion Support.
We have achieved your requirement using change event of check box and start time datetimepicker. Please refer to the following sample.
onPopupOpen(args: PopupOpenEventArgs): void {
if (args.type === 'Editor') {
args.duration = 60;
var dialogObj = (args.element as any).ej2_instances[0];
var checkBoxObj = (args.element.querySelector(
'.e-time-zone.e-checkbox'
) as any).ej2_instances[0];
checkBoxObj.label = '30 min Duration';
let startObj = (args.element.querySelector('.e-start') as any)
.ej2_instances[0];
let endObj = (args.element.querySelector('.e-end') as any)
.ej2_instances[0];
endObj.readonly = true;
startObj.change = function() {
if (!checkBoxObj.checked) {
endObj.value = new Date(
endObj.value.setHours(startObj.value.getHours() + 1)
);
endObj.value = new Date(
endObj.value.setMinutes(startObj.value.getMinutes())
);
} else {
endObj.value = new Date(
endObj.value.setHours(startObj.value.getHours())
);
endObj.value = new Date(
endObj.value.setMinutes(startObj.value.getMinutes() + 30)
);
}
};
checkBoxObj.change = function() {
if (!checkBoxObj.checked) {
endObj.value = new Date(
endObj.value.setHours(startObj.value.getHours() + 1)
);
endObj.value = new Date(
endObj.value.setMinutes(startObj.value.getMinutes())
);
} else {
endObj.value = new Date(
endObj.value.setHours(startObj.value.getHours())
);
endObj.value = new Date(
endObj.value.setMinutes(startObj.value.getMinutes() + 30)
);
}
};
dialogObj.open = function() {
// Changed the duration to 30 min
startObj.step = 30;
endObj.step = 30;
};
}
Please try the above solution and let us know if this meets your requirement.
Regards,
Nevitha.