How to dynamically edit the min and max dates of a datepicker?

Hi !
As the name suggest, I have a form which contains two date pickers to select a date range, one for the the min date and the other for the max date.
The issue is that I would like to make it so that the user cannot select a min date that is greater than the max date and vice-versa. I tried implementing custom logic in the “custom disabled dates” script, but it seems like I cannot access the values that are stored in ‘data’ from there.

I also tried using a custom action, which is able to access my variables in ‘data’, but I cannot figure how to edit the component’s value from there

Thanks ! Any help is greatly appreciated !

@Nougat

Have you tried to get the dates selected by user and then use a condition like minDate > maxDate and based on the output, display an error message?

Let me know what exactly you’ve done with your custom logic so, we can see what best can be done.