Reactjs 物料UI日期选择器设置为必需

Reactjs 物料UI日期选择器设置为必需,reactjs,Reactjs,我正在react应用程序中使用Material UI DatePicker,需要设置所需的日期吗 <DatePicker spacing={2} PopoverProps={{ container: this.props.container }} onChange={this.updateEndDate} value={this.state.endDate} initia

我正在react应用程序中使用Material UI DatePicker,需要设置所需的日期吗

<DatePicker
            spacing={2}
            PopoverProps={{ container: this.props.container }}
            onChange={this.updateEndDate}
            value={this.state.endDate}
            initialFocusedDate={this.state.startDate}
            minDate={this.state.startDate}
            disablePast="true"
            disableToolbar="true"
            variant="inline"
            label="End Date"

           // I have tried adding required, required="true", required={true}


          />
我是否需要在提交时创建自定义验证器检查值,或者是否有一个道具可用于将字段设置为必需

<DatePicker
            spacing={2}
            PopoverProps={{ container: this.props.container }}
            onChange={this.updateEndDate}
            value={this.state.endDate}
            initialFocusedDate={this.state.startDate}
            minDate={this.state.startDate}
            disablePast="true"
            disableToolbar="true"
            variant="inline"
            label="End Date"

           // I have tried adding required, required="true", required={true}


          />


物料界面/日期选择器上没有所需的
属性/属性。可以做的是设置一个默认日期,比如今天。并处理错误/所需标准
onChange

你试过什么?你能给我们看一些代码吗?