How to force default value of date to selected date automatically? #3861
-
|
Hello, I have an application with a Dashboard with a main calendar (another library - I have a form for adding visit - date day is from state of active date (from React Calendar selected). I have a problem with your library This active date from The problem is that this I've tried several possible ways, but I have no idea how to make the active date value auto-selected in react-datepicker. Below is my code: Select day: Select hour: I will be grateful for your help or any idea. All the best, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
My hypothesis is that it has something to do with the way you are using I've used What do you think? |
Beta Was this translation helpful? Give feedback.
My hypothesis is that it has something to do with the way you are using
selected={field.value}in the attributes of<DatePickerI've used
DatePickeralong withreact-hook-formin a similar way to what you have but in my version, I use the local state as the value to pass to theselectedattribute. e.g. in your case, that looks like it would beselected={startDate}instead.What do you think?