Topic: Date Picker Value

Bart Cernel free asked 5 years ago


I'm having issues with the react Datepicker component.  Everything works fine from the component itself, however, I am unable to update the value of the date from a different function or other external method.  For example, I'm putting in a dropdown that will allow me to select ranges such as 'last week, or last 30 days' and am calculating the dates myself.  I call setState and update the correct state (startDate) but the Datepicker component does not register the change.  I also put in a label just to show the state as well and it does update, so I'm positive the change is taking place, but the picker itself will not actually update the value in the input box.  The console is not showing any warning or errors.  Any suggestions?

<DatePicker
format='MM-DD-YYYY'
keyboard
value={this.state.endDate}
getValue={ (evt) => this.setState({endDate: evt})}
mask={[/\d/, /\d/,'-', /\d/, /\d/,'-', /\d/, /\d/ , /\d/, /\d/]}
label="End Date" />


Jakub Mandra staff answered 5 years ago


Hi,

It is becouse DatePicker has no implementation for inner state update when value property updates.
It is outer component and we are still working on improves.

We will inform in changelog about progress.



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB React
  • MDB Version: 4.8.3
  • Device: Laptop
  • Browser: Chrome
  • OS: Windows 10
  • Provided sample code: Yes
  • Provided link: No