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

Default date doesnt get updated #12

Open
sjonchhe opened this issue Jul 20, 2022 · 3 comments
Open

Default date doesnt get updated #12

sjonchhe opened this issue Jul 20, 2022 · 3 comments

Comments

@sjonchhe
Copy link

sjonchhe commented Jul 20, 2022

defaultDate doesnt update on rerender. it only works if default date exists in initial render

I have got 2 datepickers, I am trying to set default date of second date picker when date has been selected on the first datepicker. But default date on second datepicker doesnt get updated. Is there any workaround for this?

https://codesandbox.io/s/zen-monad-s5t7u5?file=/src/App.js

@sbmdkl
Copy link
Owner

sbmdkl commented Jul 20, 2022

The defaultDate is set once only when the component is mounted. The date is not updated then by changing defaultDate as the date value is changed with the user's interaction with the date in the calendar.

@sbmdkl
Copy link
Owner

sbmdkl commented Jul 20, 2022

For your two calendar cases, you can mount the other calendar component using defaultValue when the first calendar is set not both at the same time, or use a new key to force rerender the calendar.

@nabanitkoirala
Copy link

How can i set value of selected date,their is no props for adding value of selected field

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

No branches or pull requests

3 participants