※社内専用

曜日非選択 【flatpickr】

お問い合わせでカレンダー flatpickrを使ったカレンダー
指定の曜日を非選択でできないかというお問い合わせがありましたので
調べてみました。 __setting.php
火曜日を非選択の場合は以下のように追記
 disable: [
      function(date) {
          // return true to disable
          return (date.getDay() === 2);

      }
  ],
全体
  function hook_flatpickr_script() {
    $output = "<script>
                jQuery(function($) {
                  $('.flatpickr').flatpickr({
                    disable: [
                        function(date) {
                            // return true to disable
                            return (date.getDay() === 2);

                        }
                    ],
                    locale: {
                      firstDayOfWeek: 0,
                      weekdays: {
                        shorthand: ['日', '月', '火', '水', '木', '金', '土'],
                      },
                      months: {
                        longhand: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
                      },
                    },
                  });
                })
                </script>";
    echo $output;
  }
以下参照しました。
https://38elements.github.io/2016/11/05/flatpickr.html
https://chmln.github.io/flatpickr/examples/#disabling-all-dates-except-select-few