【问题标题】:Restrict Times in JQuery UI Datepicker Timepicker Add-on在 JQuery UI Datepicker Timepicker Add-on 中限制时间
【发布时间】:2014-03-13 21:50:42
【问题描述】:

我正在为 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 等有谁知道我如何编码?

【问题讨论】:

    标签: jquery jquery-ui datepicker jquery-ui-timepicker


    【解决方案1】:

    看起来像 Trent debated adding this feature a while ago,但后来没有继续前进。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-08-03
      • 1970-01-01
      • 1970-01-01
      • 2019-12-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多