How to disable datepicker dates via function?

Hello. I understand that sw-datepicker uses flatpickr and according to flatpickr, dates can be disables via functions. I want to do the same thing but sw-datepicker uses objects to take custom configurations in twig file. An example is the one below


How can I use a function within this twig to disable dates (for example to disable certain days of week etc), as shown in the flatpickr documentation:

Same problem here, can’t seem to find out how this works using the documentation.
Did you already solve the issue?

I did this ungodly abomination in js plugin that you guys could probably refactor to be a better:

  disableSaturdaysAndSundays() {
      const days = document.getElementsByClassName('flatpickr-day');
      for (let i = 0; i < days.length; i++) {
         const day = days[i];
         if (day.classList.contains('flatpickr-disabled')) {
           continue;
         }
        // TODO fix this bullshit
        if (i == 11 || i == 12 || i == 18 || i == 19 || i == 25 || i == 26 || i == 32 || i == 33 || i == 39 || i == 40 || i == 46 || i == 47) {
             day.classList.add('flatpickr-disabled');
          }
        }
     }

after this do this in your init function:

        const targetNode = document.getElementsByClassName('flatpickr-days')[0];

       // Options for the observer (which mutations to observe)
        const config = { childList: true };
        
        // Callback function to execute when mutations are observed
        const callback = (mutationsList, observer) => {
            for (let mutation of mutationsList) {
                if (mutation.type === 'childList') {
                    this.disableSaturdaysAndSundays();

                }
            }
        };
        
        // Create a new observer instance linked to the callback function
        const observer = new MutationObserver(callback);
        
        // Start observing the target node for configured mutations
        observer.observe(targetNode, config);