この効果を実現するには、まず monBegin を設定する必要があります。この時間は、選択ボックスで選択された時間です。デフォルトがない場合は、選択した時間以降のデフォルトを設定します。
const datadisabledDateMonth = current => {
const time = monBegin || moment().startOf('year')
const result = moment().add(12, 'month') .diff(moment(time), 'month'); // 计算选中日期和今天之后29天的日期差
const days = moment(time) > moment() ? result : 12;
const startTime = time;
const start = startTime && moment(startTime).subtract(days, 'month') > current;
const end = monBegin&& moment(monBegin).add(days, 'month') < current;
return monBegin? start || end : end;
}
2つ目は最大14日間を設定することです
const datadisabledDate = current => {
const time = disBegin || moment();
const result = moment().add(13, 'days').diff(moment(time), 'days'); // 计算选中日期和今天之后29天的日期差
const days = moment(time) > moment() ? result : 13;
const startTime = time;
const start = startTime && moment(startTime).subtract(days, 'days') > current;
const end = disBegin && moment(disBegin).add(days, 'days') < current;
return disBegin ? start || end : end;
};