0

我正在为 JQuery Datepicker 使用Trent Richardsons Timepicker插件,我需要能够限制我们的用户可以选择的时间。

到目前为止我的代码:

$('.datepicker').datetimepicker({
    showOn: "both",
    buttonImage: "/images/icons/cal-clock-icon-16x16.png",
    buttonImageOnly: true,
    showButtonPanel: true,
    changeMonth: true,
    changeYear: true,
    hourMin: 8,
    hourMax: 16,
    stepMinute: 15,
    minuteGrid: 15,
    addSliderAccess: true,
    sliderAccessArgs: {touchonly: false},
    altField: "#testTime",
    altFieldTimeOnly: false,
    altFormat: "yy-mm-dd",
    altTimeFormat : "HH:mm:ss",
    dateFormat: "D, d MM yy",
    timeFormat: "hh:mmtt"
});

所以我有最小和最大小时数,我会根据需要每隔 15 分钟跳一次,但有些特定的时间我不想让他们预定。因此,例如,我不希望他们选择 8:15、8:45、9:15、9:45、10:00、10:15 等有谁知道我可以如何编码?

4

1 回答 1

1

看起来 Trent不久前曾讨论过添加此功能,但后来没有继续进行。

如果有帮助, Jon Thornton 的Timepicker插件有一个DisableTimeRanges选项。

于 2014-03-13T23:37:01.640 回答