如何使bootstrap-datetimepicker以15分钟为间隔显示时间

Jag*_*ggi 1 javascript asp.net-mvc jquery bootstrap-modal

这是我的Javascript代码,在间隔1中以分钟为单位递增

fillMinutes = function () {
            var table = widget.find('.timepicker-minutes table'),
                currentMinute = viewDate.clone().startOf('h'),
                html = [],
                row = $('<tr>'),
                step = options.stepping === 1 ? 5 : options.stepping;

            while (viewDate.isSame(currentMinute, 'h')) {
                if (currentMinute.minute() % (step * 4) === 0) {
                    row = $('<tr>');
                    html.push(row);
                }
                row.append('<td data-action="selectMinute" class="minute' + (!isValid(currentMinute, 'm') ? ' disabled' : '') + '">' + currentMinute.format('mm') + '</td>');
                currentMinute.add(step, 'm');
            }
            table.empty().append(html);
        }
Run Code Online (Sandbox Code Playgroud)

我想修改此值以每隔15分钟递增一次。有人可以帮我吗

Kar*_*son 7

stepping我相信您想要的选项是这样的:

<script type="text/javascript">
    $(function () {
        $('#yourTimePickerElement').datetimepicker({
            stepping: 15
        });
    });
</script>
Run Code Online (Sandbox Code Playgroud)

这是有关以下内容的文档stepping

默认值:1

分钟数,向上/向下箭头将移动时间选择器中的分钟值


Bootstrap 3 Datepicker文档