// Get all elements with the class 'datePicker'
var datePickers = document.querySelectorAll('.datePicker');

// Add event listener to each date picker
datePickers.forEach(function (datePicker) {
    var startDateInput = datePicker.querySelector('.picker');
    var endDateInput = datePicker.querySelector('.picker + .picker');

    startDateInput.addEventListener('input', function () {
        // Set the minimum value of the end date input to the selected start date
        endDateInput.min = startDateInput.value;

        // If the end date is currently set to a value before the start date, reset it
        if (endDateInput.value < startDateInput.value) {
            endDateInput.value = startDateInput.value;
        }
    });
});