简体   繁体   English

禁用特定日期

[英]Disable Specific Date

So I want to Disable Specific date in Months, This is my Function in Controller called "jurnal.php"所以我想以月为单位禁用特定日期,这是我在控制器中名为“jurnal.php”的函数

function jurnal_harian_form() {
        setlocale(LC_ALL,"US");
        echo "<h3 id='title'>Jurnal Harian :: Daftar SKP :: Form Jurnal Harian</h3>";
        $_GET['nip'] = ($_SESSION['NIP']);
        $data_profil_pegawai = $this->jurnal_mdl->get_data_statistik_Jabatan();
        $harilibur = $this->jurnal_mdl->GetHariLibur();
        $currentYear = date("Y");
        $currentDay = date("d");
        $month = strftime("%B");
        $min =  date('Y-m-d', strtotime("$month $currentYear + 14 days"));
        $now =  date('Y-m-d');

        $r =0;
        for ($i=1; $i < 6 ; $i++) { 
            $gg = date('Y-m-d',strtotime("$i $month $currentYear"));
            $issun = date('w',strtotime("$gg"));
            if ($issun == '6' || $issun == '0') {
                $min =  date('Y-m-d', strtotime("$min +1 days"));
                $r++;
            } 
            
        }

        $hasilmin = '';
        $hasilmax = '';
        if($now >= $min){
            $hasilmin = date('Y-m-d', strtotime("first day of $month $currentYear"));
            if ($r == 1) {
                $hasilmax = date('Y-m-d', strtotime("$month $currentYear +1 month +6 days"));
            } elseif($r == 2) {
                $hasilmax = date('Y-m-d', strtotime("$month $currentYear  +14 days"));
            }else{
                $hasilmax = date('Y-m-d', strtotime("$month $currentYear +1 month +5 days"));
            }  
        }else if($now == $min){
            $hasilmin = date('Y-m-d', strtotime("first day of $month $currentYear"));
            if ($r == 1) {
                $hasilmax = date('Y-m-d', strtotime("$month $currentYear +5 days"));
            } elseif($r == 2) {
                $hasilmax = date('Y-m-d', strtotime("$month $currentYear +6 days"));
            }else{
                $hasilmax = date('Y-m-d', strtotime("$month $currentYear +4 days"));
            }
        }else{
            $hasilmin = date('Y-m-d', strtotime("first day of $month $currentYear "));
            if ($r == 1) {
                $hasilmax = date('Y-m-d', strtotime("$month $currentYear +5 days"));
            } 
            elseif($r == 2 && $currentDay <= 15) {
                $hasilmax = date('Y-m-d', strtotime("$month $currentYear +14 days"));
            }
            elseif($r == 2 && $currentDay >= 15) {
                $hasilmax = date('Y-m-d', strtotime("$now +14 days"));
            }
            else{
                $hasilmax = date('Y-m-d', strtotime("$month $currentYear +4 days"));
            } 
        }
       
        $data = array(
            "html_store" => $this->get_store_form_tambah_jurnal(),
            "pegawai"    => $data_profil_pegawai,
            "harilibur"  => $harilibur,
            "minvalue"   => $hasilmin,
            "maxvalue"   => $hasilmax
        );
        $this->load->view('jurnal/grid_jurnal_harian2', $data);
    }

I want to make ,when the month is still on the 1st to 15th, the 16th to the end of the month is disabled, but if it's already on the 16th, the 1st to 15th is disabled.我想制作,当月份还在1号到15号时,16号到月底被禁用,但如果已经是16号,则1号到15号被禁用。 how to make this happend?如何做到这一点?

If you want to limit days in date field of the Front end (extjs), you can use setDisabledDates method of the Date Field.如果要限制前端(extjs)的日期字段中的天数,可以使用日期字段的setDisabledDates方法。

Ex: To disable the 5th and 6th of October, use: datefield.setDisabledDates(["10/05/2003", "10/06/2003"])例如:要禁用 10 月 5 日和 6 日,请使用: datefield.setDisabledDates(["10/05/2003", "10/06/2003"])

For more detail, view the link欲知更多详情,请查看链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM