react-ant-design日期选择框时间选择限制

1、
预期效果
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
2、需要加的限制是不能开始时间不能小于一个日期,结束时间不能超过今天。
3、实现代码

    this.handleDisabledStartDate = current => {
    
    
      return current < moment(e.props.title) || current > moment(lastEndDate);
    };
    this.handleDisabledEndDate = current => {
    
    
      return current < moment(e.props.title) || current > moment(lastEndDate);
    };

4、这里时间比较注意当时间是字符串形式的时候,需要转换为时间戳进行比较
更详细可参考这里详细

猜你喜欢

转载自blog.csdn.net/weixin_45416217/article/details/107093812