我正在尝试在dateTIMEpicker中禁用月份,而不是在月份模式下的datepicker(并且需要保持该模式)。
我需要禁用的月份是datePickerFrom之前的月份。
这是我的代码:
$('#newDialog #datePickerFrom').datetimepicker({
format: 'dd.MM.yyyy',
viewMode: 'months',
minViewMode: 'months',
pickTime: false
});
$('#newDialog #datePickerTo').datetimepicker({
format: 'dd.MM.yyyy',
viewMode: 'months',
minViewMode: 'months',
pickTime: false
});
$('#newButton').click(function() {
var dialog = $('#newDialog');
$('#dialogHeader').text("New monthly fee");
resetValue($("#id", dialog), '');
resetValue($("#countryId", dialog), '');
resetValue($("#typeId", dialog), '');
resetValue($("#currencyId", dialog), '');
resetValue($("#reportChannelTypeId", dialog), '');
resetValue($("#value", dialog), '0.00');
resetValue($("#description", dialog), '');
resetValue($("#validTo", dialog), '');
var date = new Date();
var firstDay = new Date(date.getFullYear(), date.getMonth(), 1);
var pickerFrom = $('#newDialog #datePickerFrom').data('datetimepicker');
firstDay.setHours(0, 0, 0, 0);
pickerFrom.setLocalDate(firstDay);
$('#newDialog #datePickerTo').datetimepicker().on("changeDate", function(e) {
var endDay = new Date(e.date.getFullYear(), e.date.getMonth() + 1, 0);
var pickerEnd = $('#newDialog #datePickerTo').data('datetimepicker');
endDay.setHours(23,59,59,999);
pickerEnd.setLocalDate(endDay);
});