Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use shouldDisableDate #3596

Closed
MikhailBakaevdev opened this issue Jan 30, 2024 · 1 comment · Fixed by #3598
Closed

Cannot use shouldDisableDate #3596

MikhailBakaevdev opened this issue Jan 30, 2024 · 1 comment · Fixed by #3598

Comments

@MikhailBakaevdev
Copy link

What version of rsuite are you using?

5.50.0

What version of React are you using?

18.2.0

What version of TypeScript are you using (if any)?

4.3.5

What browser are you using?

Chrome

Describe the Bug

Hi there! After import methods in this example with shouldDisableDate https://rsuitejs.com/components/date-range-picker/
Methods not works and i got error like in screenshot. How i can avoid this error and pass available date range to shouldDisableDate prop?
Screenshot 2024-01-30 at 17 34 58

Expected Behavior

No response

To Reproduce

No response

@simonguo
Copy link
Member

Hi @MikhailBakaevdev , The reason for this problem is that the declaration of the afterToday function in TypeScript may be undefined. You can temporarily solve this problem in the following ways:

<DateRangePicker 
-  shouldDisableDate={afterToday()} 
+  shouldDisableDate={afterToday?.()} 
/>;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants