简体   繁体   English

使用 bootstrap-datetimepicker 启用特定日期

[英]Enable specific dates using bootstrap-datetimepicker

It is possible to enable specific dates using bootstrap-datetimepicker.min.js?是否可以使用 bootstrap-datetimepicker.min.js 启用特定日期? I have tried:我试过了:

$('.date').datetimepicker({
    language: "en-gb",
    enabledDates: ["2020-11-20, 2020-11-22, 2020-11-25"],
    pickTime: false
});

but just only first date 2020-11-20 is enabled.但仅启用了第一个日期2020-11-20 I have an array of specific dates which I need to enable.我有一系列需要启用的特定日期。 Other days must be disabled.其他日子必须禁用。

I have stuck here.我一直卡在这里。 Maybe it is impossible?也许这是不可能的?

enabledDates take an array of string , Date object or moment object . enabledDates接受一个string数组、 Date objectmoment object

Takes an [ string or Date or moment ] of values and allows the user to select only from those days.采用 [ 字符串或日期或时刻 ] 值,并允许用户仅从这些日期中进行选择。

From documentation文档

So you were close... Just take care about the array structure!所以你很接近......只需注意数组结构!

Try this:尝试这个:

$('.date').datetimepicker({
    language: "en-gb",
    enabledDates: ["2020-11-20", "2020-11-22", "2020-11-25"], // Check the quotes!
    pickTime: false
});

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

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