ant design react中的disabledDate不可选择时间的处理
ant design react中的disabledDate不可选择时间的处理
<Col {...colSpanLayout}>
<FormItem label="业务日期" {...formItemLayout} >
{getFieldDecorator('busDate', {
initialValue: moment(
model.busDate === undefined ? moment() : model.busDate,
'YYYY-MM-DD'
),
})(
<DatePicker disabled={type === 2} style={{width:'100%'}} placeholder="请选择日期" disabledDate={disabledDate}/>
)}
</FormItem>
</Col>
function disabledDate(current) {
// Can not select days before today and today
// return current && current.valueOf() < Date.now();//当天之前的不可选,包括当天
//return current && current < moment().endOf(‘day’);//当天之前的不可选,包括当天
return current < moment().subtract(1, 'day') //当天之前的不可选,不包括当天
}