嗨,我正在尝试用flatpickr替换datetimepicker ,但我无法处理这种情况。不希望使用 flatpickr 的 Range 插件我希望能够使用 onChange 事件更改实例的 minDate 或 maxDate。不幸的是,我在指南上几乎没有找到有关此段落的信息
flatpickr('#start_time', {
locale: 'it',
enableTime: true,
plugins: [
new confirmDate({
confirmIcon: "<i class='fa fa-check'></i>",
confirmText: '',
showAlways: true,
}),
],
showAlways: false,
theme: 'airbnb',
time_24hr: true,
altInput: true,
altFormat: 'F j, Y H:i',
dateFormat: 'Z',
weekNumbers: true,
maxDate: $('#end_time').attr('value'),
onClose: function(selectedDates, dateStr, instance) {
// Change #end_time minDate
},
});
flatpickr('#end_time', {
locale: 'it',
enableTime: true,
plugins: [
new confirmDate({
confirmIcon: "<i class='fa fa-check'></i>",
confirmText: '',
showAlways: true,
}),
],
showAlways: false,
theme: 'airbnb',
time_24hr: true,
altInput: true,
altFormat: 'F j, Y H:i',
dateFormat: 'Z',
weekNumbers: true,
minDate: $('#start_time').attr('value'),
onClose: function(selectedDates, dateStr, instance) {
// Change #start_time maxDate
},
});
我试图玩$('#start_time')[0]._flatpickr.config._maxDate
但没有成功
谢谢 ;)