Flatpickr会在没有选择的情况下关闭当天的日期

当我打开然后关闭flatpickr实例而不选择日期时,它将其设置为今天的日期。如何防止这种行为?当用户未设置日期时,我需要输入日期以保持空白。

flatpickr实例包装有React-flatpickr。

<flatpickr
    ref={fpStartDate}
    classname='th-input-container__input'
    value={startDate}
    onClose={(selectedDates,dateStr,instance) => { 
        if (selectedDates.length > 0) {
            setInputvalue(1);
            setCurrentPage(1);
            setStartDate(selectedDates[0]);
        }
    }}
    options={{
        enableTime: true,enableSeconds: true,dateFormat: 'd.m.Y,H:i:S',locale: Russian,mode: 'single',time_24hr: true,minuteIncrement: 1,allowInput: true,disableMobile: true,monthSelectorType: 'dropdown',onOpen: function(selectedDates,instance) {
            setTimeout(function() {
                instance.open();
            },200);
        }
    }}
    placeholder='from'
/>
zhufy2009 回答:Flatpickr会在没有选择的情况下关闭当天的日期

原来是某个版本以来存在错误。确切的版本号可以在Flatpickr GitHub问题中找到。我选择的解决方案是降级。

本文链接:https://www.f2er.com/2758749.html

大家都在问