如何禁用自定义日期以及之前的日期在DatePicker中?

I am trying to disable some dates along with that I, am trying to disable Past日期嗯,请在日期选择器中删除过去日期的一些帮助。

            <div class='input-group date' id='datepicker1'>
                <asp:TextBox runat="server" ID="txtdatepicker"> 
            </asp:TextBox>
            </div>
        
             <script type="text/javascript">
          
          $(function () {
            var disableSpecificDates =  ["19-8-2021", "28-8-2021", "26- 
            8-2021"];
           
            $('#datepicker1').datepicker({
                format: 'mm/dd/yyyy',
                beforeShowDay: function (date) {
                    dmy = date.getDate() + "-" + (date.getMonth() + 1) + 
           "-" + 
                date.getFullYear();
                    if (disableSpecificDates.indexOf(dmy) != -1) {
                        return false;
                    }
                    else {
                        return true;
                    }
                }
            });
            $('#datepicker1').datepicker("setDate", new Date());
            });
           
          </script>

回答 1

  1. 赞同 0

    删除删除,您可以禁用过去的日期。

    $('#datepicker1').datepicker("minDate", new Date());
    });

    RED-DOT
    请添加更多详细信息以扩展您的答案,例如工作代码或文档引用。Comity