【发布时间】:2019-01-18 21:31:11
【问题描述】:
我有一个输入日期的注册表单。
我的日期输入代码是:
birthDate: new Date(),
this.handleSubmit = this.handleSubmit.bind(this);
this.handledChange = this.handledChange.bind(this);
handledChange(date) {
this.setState({
birthDate: date
});
}
<ControlLabel>Date de naissance</ControlLabel>
<FormGroup controlId="birthDate" bsSize="large">
<FormControl
autoFocus
type="date"
value={this.state.birthDate}
onChange={this.handledChange}
/>
</FormGroup>
我提交的时候,控制台输入的日期是undefined。
我想要它的格式:YYYY-MM-DD
请问我该如何解决?
【问题讨论】:
标签: javascript reactjs input datepicker date-format