score:0

it seems to me that you do not need new instance of moment when you pass data to mindate prop. you are doing it like this mindate={ new moment(this.props.mindate)}.

react-datepicker already internally uses moment for manipulating data objects so i think you should just remove keyword new in front of a moment when you are passing it to the mindate prop.

score:0

i figure this one myself, it appears that if selected property is set, it will shown and not the mindate property.

score:1

i think you have to give value for this, because mindate and maxdate are for validation purpose. mindate will only be the resulting value only if, when given value or current date is less then min date

class example extends react.component {
  constructor (props) {
    super(props)
    this.mindate = new moment(props.mindate)
    this.state = {
      startdate: props.mindate
    };
    this.handlechange = this.handlechange.bind(this);
  }

  handlechange(date) {
    this.setstate({
      startdate: date
    });
  }

  render() {
    return <datepicker
     selected={this.state.startdate}
     onchange={this.handlechange}
     mindate={this.mindate}
     value={this.props.startdate}
   />;
  }
}

Related Query

More Query from same tag