Hello again,
After I performed several additional tests I noticed an improvement that can be made to the script, please replace the previously offered script with this one:
document.addEventListener('kaliFormProcessConstructed', function(evt){
var startDate = document.getElementById('#startDate')._flatpickr;
var endDate = document.getElementById('#endDate')._flatpickr;
startDate.config.onChange.push(function(date){
var nextDay = new Date(date);
nextDay.setDate(nextDay.getDate() + 1)
endDate.clear();
endDate.set('minDate', nextDay)
});
})
With the latest release of Kali Forms that just rolled out you no longer need this custom script, you can define this directly from the field configuration.
When editing your Date and Time picker field you will have a new option available: Start date depending on other date picker?, you just need to select your first field in this setting and the date you select in that field will be the minimum date available in your current field.
You can also add additional days to this limit with the help of the Offset dependency option. This will add your entered offset to the date selected in the first field, for example if you select the 1st of January in the first field and set the offset to 2, then your current field will only allow selections starting from the 3rd of January.