如何在bootstrap-datetimepicker-master中禁用特定日期? [英] How to disable specific dates in bootstrap-datetimepicker-master?

查看:118
本文介绍了如何在bootstrap-datetimepicker-master中禁用特定日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$(".datepicker").datetimepicker({
    format: 'MM dd hh:ii P',
    startDate: "2016-08-19 10:00",
    daysOfWeekDisabled: [1,2,3,4,5],
    autoclose: true,    
});

如何在日期时间选择器中禁用特定日期?

How to disable specific date in datetime picker?

推荐答案

这取决于您使用的插件,有几个bootstrap-datetimepicker项目.

That will depend on which plugin you are using, there are several bootstrap-datetimepicker projects.

如果bootstrap-datetimepicker-master是,则基于此分叉,您可以使用datesDisabled:

If bootstrap-datetimepicker-master is this one, based on this fork you can use datesDisabled:

日期已禁用

字符串,数组.默认值:[]

String, Array. Default: []

以给定格式格式化的日期字符串或单个日期字符串的数组 日期格式

Array of date strings or a single date string formatted in the given date format

您可以在此处中查看.

如果您正在使用其他插件,则需要查看其文档,但是我想更多的项目都提供了datesDisabled.

If you are using other plugin you need to have a look to its docs, but I guees more of the projects have datesDisabled available.

请记住以您设置的格式指定日期,具体情况如下:'YYYY/MM/DD'.

Remember to specify the dates in the format that you have set, in your case: 'YYYY/MM/DD'.

$(".datepicker").datetimepicker({
    format: 'YYYY/MM/DD hh:ii',
    startDate: '2016/08/19 10:00',
    daysOfWeekDisabled: [1,2,3,4,5],
    datesDisabled: ['2016/08/20'],
    autoclose: true,    
});

这篇关于如何在bootstrap-datetimepicker-master中禁用特定日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆