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

Disabled days can be selected with selected prop #2047

Closed
berkin opened this issue Jan 29, 2024 · 1 comment · Fixed by #2171
Closed

Disabled days can be selected with selected prop #2047

berkin opened this issue Jan 29, 2024 · 1 comment · Fixed by #2171
Assignees
Labels
Bug Bug or Bug fixes
Milestone

Comments

@berkin
Copy link

berkin commented Jan 29, 2024

Description

Disabled days can be selected with the selected prop.
https://codesandbox.io/p/sandbox/funny-brahmagupta-2d3gdh?file=%2Fsrc%2FApp.tsx%3A9%2C5

Expected Behavior

it should not select the day.

Actual Behavior

i bind the datepicker to an input field. I disabled the future dates, but they can be selected by the input field.

image
@gpbl gpbl removed their assignment Jan 30, 2024
@berkin
Copy link
Author

berkin commented Jan 31, 2024

As a workaround, on input change, I check if the date is not matched with disabled days. It does only cover the disabled prop, not the max for example.

....
if (
			isValid(date) &&
			(props.disabled == null ||
				!isMatch(
					date,
					Array.isArray(props.disabled)
						? props.disabled
						: [props.disabled]
				))
		) {
setSelected(date)

}

@gpbl gpbl added this to the v9.0.0 milestone May 28, 2024
@gpbl gpbl added the Bug Bug or Bug fixes label May 28, 2024
@gpbl gpbl self-assigned this May 30, 2024
@gpbl gpbl linked a pull request May 30, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug or Bug fixes
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants