更改 DateTimePicker 的值
Change Values of DateTimePicker
我正在创建一个 MVC 应用程序,用户在 datetimepicker
上询问是否可以将值切换为 6
的间隔。
所以在这部分 datetimepicker
:
有没有办法将值更改为 00
、06
、12
、18
等?
感谢任何帮助。
找到了!
原始日期时间选择器基于此:
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);
},
所以我将 step = options.stepping === 1 ? 5 : options.stepping;
更改为:
step = options.stepping === 1 ? 6 : options.stepping;
我正在创建一个 MVC 应用程序,用户在 datetimepicker
上询问是否可以将值切换为 6
的间隔。
所以在这部分 datetimepicker
:
有没有办法将值更改为 00
、06
、12
、18
等?
感谢任何帮助。
找到了!
原始日期时间选择器基于此:
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);
},
所以我将 step = options.stepping === 1 ? 5 : options.stepping;
更改为:
step = options.stepping === 1 ? 6 : options.stepping;