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

166
Views
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
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!