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

Datepicker month property cannot be used #2648

Closed
Stouffi opened this issue Oct 6, 2022 · 2 comments
Closed

Datepicker month property cannot be used #2648

Stouffi opened this issue Oct 6, 2022 · 2 comments
Labels
Fixed patch Completed issues that will be published with next patch (1.0.X)

Comments

@Stouffi
Copy link
Contributor

Stouffi commented Oct 6, 2022

What package has an issue

@mantine/dates

Describe the bug

Datepicker component exposes a month property to enable controlled mode for the month display. But the onMonthChange prop counterpart is not available. In addition the value given to month is ignored.

Comparing with the Calendar component, everything work as expected the month and onMonthChange can be used and the month display is controlled.

I've linked to a codesandbox which reproduce the issue for Datepicker and showing how Calendar is currently working.

What version of @mantine/hooks page do you have in package.json?

5.5.4

If possible, please include a link to a codesandbox with the reproduced problem

https://codesandbox.io/s/repro-datepicker-month-prop-ksfldr?file=/src/App.tsx

Do you know how to fix the issue

No response

Are you willing to participate in fixing this issue and create a pull request with the fix

No response

Possible fix

When month and onMonthChange are provided, Datepicker should enable controlled mode for month display. i.e. month value should be forwarded to the inner Calendar and onMonthChange should be called directly from the inner Calendar as well as from various handlers where setCalendarMonth is called.

@rtivital
Copy link
Member

rtivital commented Oct 6, 2022

The documentation is incorrect, month is managed by internal state, I'll remove it from props table

@rtivital rtivital added the Fixed patch Completed issues that will be published with next patch (1.0.X) label Oct 18, 2022
@rtivital
Copy link
Member

Fixed, documentation for DatePicker and Calendar no longer includes this and other related props

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed patch Completed issues that will be published with next patch (1.0.X)
Projects
None yet
Development

No branches or pull requests

2 participants