blog
blog copied to clipboard
Antd && Moment
<DatePicker
placeholder="请选择"
onChange={onChange}
defaultValue={moment().subtract(1, 'days')} // 默认选择日期是今天的前一天
disabledDate={this.disabledDate}
// onChange={this.change}
/>
disabledDate(current) {
// 选择范围在今天之前(不包括今天)
return current && !current.isBetween(moment().startOf('year'), moment().subtract(1, 'days'));
// 选择范围在今天之前(包括今天)
return current && current >= moment().endOf('day');
}