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

174
Vistas
How to change default value for search by date and month

I am having issues about date value. The problem is when I click on Flexible Search On button it will appear today's date but the value is empty and I can't search anything I have to click into and change it to any date to able to click search button.

Here is my code base:

  getStartDate() {
    let date = this.props.form["startDate"];
    if (date === "") {
      date = moment().format("MM/DD/YYYY")
    }
    return date
  }

 render() {
    const { localize } = this.context;
    let dateSearch;
    let datePickerValue: any = this.getStartDate();

if (this.props.form["flexibleSearch"]) {
  dateSearch = (
    <MvSelect
      name="startDate"
      onChange={this.handleInput}
      label={localize('static.content.search-month')}
      required={true}
      value={this.props.form["startDate"]}
      items={this.props.criteria.searchMonths}
      tabIndex={2}
    />
  );
} else {

  dateSearch = (
    <MvDatePicker
      id="exact-date"
      name="startDate"
      required={true}
      tabIndex={2}
      softError={"Date not in range"}
      items={this.props.criteria.searchMonths}
      placeholder={localize('static.content.search-by-date')}
      onChange={this.handleInput}
      value={datePickerValue}
    />

enter image description here

And I figured out that when I added this line of code this.props.form["startDate"] = date into function getStartDate() it will able to search because I have the default value but if I do that I will lost the default value when I search for month which is "Search By Month" is default value but now it's showing "Oct 2021" as a default value

enter image description here

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