我在Datepicker
制成的表单中使用了Bootstrap 4
,现在我需要禁用一年中假日的日期,但是我不能这样做。
表单中的Datepicker调用代码:
<label class="col-form-label">Fecha Hasta:</label>
<div class="form-group form-bordered col-md-2 m-b-10">
<input type="text" name="fechaHasta" class="form-control" id="fechaFin" placeholder="Select Date" value="<%=request.getAttribute("fechaHasta")%>" onclick="ShowCalendarFin()" />
</div>
Datepicker代码:
function ShowCalendarFin(){
$("#fechaFin").datepicker({
changeMonth : true,
changeYear : true,
autoclose: true,
firstDay : 1,
minDate : new Date(2005, 0, 1),
yearRange : '2005:'
+ String((new Date()).getFullYear() + 1),
dateFormat : "dd/mm/yy",
language: "es",
dayNames : [ "Domingo", "Lunes", "Martes", "Miércoles",
"Jueves", "Viernes", "Sábado" ],
dayNamesMin : [ "Do", "Lu", "Ma", "Mi", "Ju", "Vi", "Sa" ],
monthNames : [ "Enero", "Febrero", "Marzo", "Abril",
"Mayo", "Junio", "Julio", "Agosto", "Septiembre",
"Octubre", "Noviembre", "Diciembre" ],
monthNamesShort : [ "Ene", "Feb", "Mar", "Abr", "May",
"Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic" ],
datesDisabled: [
"01/01/2019","19/04/2019","20/04/2019","01/05/2019",
"21/05/2019","29/06/2019","16/07/2019","15/08/2019",
"18/09/2019","19/09/2019","20/09/2019","12/10/2019",
"31/10/2019","01/11/2019","08/12/2019","25/12/2019"
]
});
}
dateDisabled功能不包含要禁用的日期,正如我在https://eonasdan.github.io/bootstrap-datetimepicker/#enableddisabled-dates中看到的那样,使用此功能的方法是:
disabledDates: [
moment("12/25/2013"),
new Date(2013, 11 - 1, 21),
"11/22/2013 00:53"
]
我尝试使用new Date
,moment ()
,但是我无法取消禁用日期,是否知道自己做错了或缺少什么?
在此先感谢您的宝贵时间。