react-component / picker

📅 All Date Pickers you need.
https://picker.react-component.now.sh/
MIT License
257 stars 295 forks source link

DatePicker 中的 disabledDate 属性在选择年的时候 有异常 #796

Closed lucas200631 closed 2 months ago

lucas200631 commented 2 months ago

我的逻辑是 EndDate 不能大于 StartDate, 当我StartDate选择 2023年6月1日的时候, 我的EndDate不能选择 2023年这个年的选项 是disabled,但是如果我 StartDate选择的是 2023年5月1日(甚至小)的时候,我的EndDate才可以选择 2023这是为什么?


 const disabledEndDate = (current, startDate) => {
    const startDateFormat = dayjs(startDate).format('YYYY-MM-DD');
    const startDateLast = dayjs(`${startDateFormat} 00:00:00`);
    return current && startDate && current <= startDateLast;
  };

![image](https://github.com/react-component/picker/assets/54296803/da545167-23f9-4cb7-959c-01f73756db6b)