Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

265
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda