ant-design / ant-design

An enterprise-class UI design language and React UI library
https://ant.design
MIT License
93.72k stars 51.17k forks source link

Calendar disable future dates but select years and months aren't disabled #52658

Open vitalijalbu opened 1 week ago

vitalijalbu commented 1 week ago

Reproduction link

Edit on CodeSandbox

Steps to reproduce

What is expected?

future years and months MUST NOT be selectable from select

What is actually happening?

future years and months ARE selectable from select

Environment Info
antd 5.23.3
React 18
System mac
Browser chrome
petercat-assistant[bot] commented 1 week ago

It seems like you're experiencing an issue with the Ant Design Calendar component where future years and months are selectable even when dates beyond the current day are disabled. This behavior might not be the expected one, as you want to prevent users from selecting future dates entirely, including years and months.

To address this issue, you can try the following approaches:

  1. Custom Date Picker Logic: Implement custom logic to handle the disabling of future years and months. You can achieve this by controlling the available options in the year and month selectors based on the current date.

  2. Check for Updates: Ensure that you are using the latest version of Ant Design, as there might be updates or fixes related to this behavior.

  3. Community and Support: If the issue persists, consider reaching out to the Ant Design community or checking the GitHub repository for similar issues or potential fixes.

If you need further assistance, feel free to provide more details or ask specific questions, and I'll be happy to help!

🪧 Tips For further assistance, please describe your question in the comments and @petercat-assistant to start a conversation with me.
vitalijalbu commented 1 week ago

Image

vitalijalbu commented 1 week ago

https://codesandbox.io/p/sandbox/37c43f?file=%2Fsrc%2FApp.js%3A9%2C24

vitalijalbu commented 1 week ago

It seems like you're experiencing an issue with the Ant Design Calendar component where future years and months are selectable even when dates beyond the current day are disabled. This behavior might not be the expected one, as you want to prevent users from selecting future dates entirely, including years and months.

To address this issue, you can try the following approaches:

  1. Custom Date Picker Logic: Implement custom logic to handle the disabling of future years and months. You can achieve this by controlling the available options in the year and month selectors based on the current date.
  2. Check for Updates: Ensure that you are using the latest version of Ant Design, as there might be updates or fixes related to this behavior.
  3. Community and Support: If the issue persists, consider reaching out to the Ant Design community or checking the GitHub repository for similar issues or potential fixes.

If you need further assistance, feel free to provide more details or ask specific questions, and I'll be happy to help!

🪧 Tips

Has nothing to do with that bug

typenoob commented 6 days ago

Hi, if possible, I would like to work on this. Leave a message here to notice others.

typenoob commented 6 days ago

我发现rc-picker中判断年份是否disable的逻辑是一年中的第一天和最后一天是否disable,要复用这个逻辑吗?是不是考虑到性能问题,而不判断每一天是否disable呢?