經常需要二級聯動的日期上面, DatePicker在模擬器和真機上面有一點小差別,
我們經常需要 截止時間不小於開始時間,在模擬器上,
開始時間
結束時間,但是結束時間可以比開始時間提前一天!
在真機上測試時,就是正常的。
<DatePicker
style={{width: pTd(130)}}
date={this.state.createTimeStart}
mode="date"
placeholder="生產日期"
format="YYYY-MM-DD"
minDate="2016-05-01"
maxDate="2040-06-01"
confirmBtnText="Confirm"
cancelBtnText="Cancel"
customStyles={{
dateIcon: {
display: 'none'
},
dateInput: {
height: pTd(32),
// marginLeft: 36
}
// ... You can check the source to find the other keys.
}}
onDateChange={(date) => {
this.setState({
createTimeStart: date,
createTimeEnd: date
})
}}
/>
<DatePicker
style={{width: pTd(130)}}
date={this.state.createTimeEnd}
mode="date"
placeholder="生產日期"
format="YYYY-MM-DD"
minDate={this.state.createTimeStart == "" ? "2016-05-01" : this.state.createTimeStart}
maxDate="2040-06-01"
confirmBtnText="Confirm"
cancelBtnText="Cancel"
customStyles={{
dateIcon: {
display: 'none'
},
dateInput: {
height: pTd(32),
// marginLeft: 36
}
// ... You can check the source to find the other keys.
}}
onDateChange={(date) => {
this.setState({
createTimeEnd: date,
createTimeStart: this.state.createTimeStart == "" ? date : this.state.createTimeStart
})
}}
/>