title: Default today's date in date picker using react js without using DatePicker component
body: <p>In my TODO list app I have datepicker field named startDate for which I want the default date to be current date.</p>
  
  <p>Here is the code:
  I have tried define defaultValue but that is giving me error as date not defined.</p>
  
  <p>Picker code:</p>
  
  <pre><code>                  &lt;Label for="start"&gt;Start Date&lt;/Label&gt;
                    &lt;Input
                      type="date"
                      name="startDate"
                      //defaultValue= {this.state.activeItem.date}
                      value={this.state.activeItem.startDate}
                      onChange={this.handleChange}
                    /&gt;
                  &lt;/FormGroup&gt;
                  &lt;FormGroup&gt;
                    &lt;Label for="end"&gt;End Date&lt;/Label&gt;
                    &lt;Input
                      type="date"
                      name="endDate"
                      value={this.state.activeItem.endDate}
                      onChange={this.handleChange}
  </code></pre>
  
  <p>This is the code I have written to fetch default date:</p>
  
  <pre><code>     curr.setDate(curr.getDate());
       var date = curr.toISOString().substr(0,10);
  </code></pre>
  
  <p>I am not getting where to perform the above operation inside constructor or render method.</p>
  
  <p>Here's the complete class code</p>
  
  <pre><code>export default class CustomModal extends Component {
        constructor(props) {
          super(props);
          this.state = {
            activeItem: this.props.activeItem
          };
        }
        handleChange = e =&gt; {
          let { name, value } = e.target;
          if (e.target.type === "checkbox") {
            value = e.target.checked;
          }
          const activeItem = { ...this.state.activeItem, [name]: value };
          this.setState({ activeItem });
        };
        render() {
          const { toggle, onSave } = this.props;
          return (
            &lt;Modal isOpen={true} toggle={toggle}&gt;
              &lt;ModalHeader toggle={toggle}&gt; Todo Item &lt;/ModalHeader&gt;
              &lt;ModalBody&gt;
                &lt;Form&gt;
                  &lt;FormGroup&gt;
                    &lt;Label for="title"&gt;Title&lt;/Label&gt;
                    &lt;Input
                      type="text"
                      name="title"
                      value={this.state.activeItem.title}
                      onChange={this.handleChange}
                      placeholder="Enter Todo Title"
                    /&gt;
                    &lt;FormGroup&gt;
                    &lt;Label for="start"&gt;Start Date&lt;/Label&gt;
                    &lt;Input
                      type="date"
                      name="startDate"
                      //defaultValue= {this.state.activeItem.date}
                      value={this.state.activeItem.startDate}
                      onChange={this.handleChange}
                    /&gt;
                  &lt;/FormGroup&gt;
                  &lt;FormGroup&gt;
                    &lt;Label for="end"&gt;End Date&lt;/Label&gt;
                    &lt;Input
                      type="date"
                      name="endDate"
                      value={this.state.activeItem.endDate}
                      onChange={this.handleChange}
                    /&gt;
                  &lt;/FormGroup&gt;
                  &lt;/FormGroup&gt;
                  &lt;FormGroup&gt;
                    &lt;Label for="description"&gt;Description&lt;/Label&gt;
                    &lt;Input
                      type="text"
                      name="description"
                      value={this.state.activeItem.description}
                      onChange={this.handleChange}
                      placeholder="Enter Todo description"
                    /&gt;
                  &lt;/FormGroup&gt;
                  &lt;FormGroup check&gt;
                    &lt;Label for="completed"&gt;
                      &lt;Input
                        type="checkbox"
                        name="completed"
                        checked={this.state.activeItem.completed}
                        onChange={this.handleChange}
                      /&gt;
                      Completed
                    &lt;/Label&gt;
                  &lt;/FormGroup&gt;
                &lt;/Form&gt;
              &lt;/ModalBody&gt;
              &lt;ModalFooter&gt;
                &lt;Button color="success" onClick={() =&gt; onSave(this.state.activeItem)}&gt;
                  Save
                &lt;/Button&gt;
              &lt;/ModalFooter&gt;
            &lt;/Modal&gt;
          );
        }
      }
  </code></pre>