react-component / calendar

React Calendar
http://react-component.github.io/calendar/
MIT License
1.7k stars 495 forks source link

disabledMonth & disabledYear - similar to disabledDate #529

Open Matiszak opened 5 years ago

Matiszak commented 5 years ago

Hi, I'd like to propose feature request that I think would be beneficial:

currently we can select which dates can be disabled (grayed out) by providing disabledDate function.

I prose to introduce similar functions disabledMonth and disabledYear to allow rc-calendar to disable(grey out) mongths/years on month/year selection panels. Currently I'm thinking about implementing this for single and range calendar.

If such feature request gets approved I'm willing to create a PR with such a feature.

arolonger commented 5 years ago

Current situation I'd say is more like a bug. From example: we pass disabledDate to allow dates from now to the future but we can still pick previous month/year/decade from now.

I think we can achive that what your saying using just disabledDate function. I did it for single calendar only, tests failed on range calendar.

Let me know what do you think, is it a good way we could follow? https://github.com/react-component/calendar/pull/564

Matiszak commented 5 years ago

@zombieJ what do you think about @arolonger solution ?

zombieJ commented 5 years ago

Maybe disable year / month when disabledDate provided is better. You can continue work with this.

But since Ant Design 4.0 with rewrite DatePicker design style, it may do some refactor or rewrite work on rc-calendar at Q4. Just notice here, in case out of sync.