【避坑指“难”】DatePicker只能选择过去时间和当前时间,禁用将来时间

import moment from 'moment';
import 'moment/locale/zh-cn';

function disabledDate(current) {
    
    
	// Can not select days before today and today
	return current && current > moment().endOf('day');
}

 <RangePicker
            style={
    
    {
    
     width: 240, height: 40 }}
            format="YYYY-MM-DD"
            onChange={
    
    item.change}
		    disabledDate={
    
    disabledDate}
/>

猜你喜欢

转载自blog.csdn.net/weixin_42224055/article/details/117693743