Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

266
Views
React JS How to change value in @material-ui keyboarddatepicker which is already bound to a model field

In React JS I have a dropdown and a @material-ui keyboarddatepicker. My datepicker is bound to a field in a json file...

<div>                    
Expiry Date:<KeyboardDatePicker
id="ExpiryDate"
disablePast 
minDate={new Date()}
format="D/MM/yyyy" 
mask="__/__/____"
value={Person.LocationExpiryDate} 
/>
</div>

Note the bound value above from the'Person' model.

I have a dropdown control which on it's onChange event I would like to change the value in the keyboarddatepicker to 6 months hence....

{this.DropdownControl(lookups.PracticeLocations, true, Person.CPPEPracticeLocation, event => this.HandleChangePerson(event, 'Location'))}
</div>

HandleChangePerson (event, propertyName) {

if (propertyName == 'Location') {

// Get date 6 months from today
const todayDate =  new Date().toISOString().slice(0, 10);
const newExpiryDate = moment(todayDate).add(6, 'M').format('D/MM/YYYY') 
// TODO: code here to change the keyboarddatepicker value.

}

I've tried using state and plain js to change the value but because it is already bound it doesn't change the value

I've looked up 'two way binding' but can't seem to find anything that references using a model.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!