hotfix/2.15.1.2407.01

This commit is contained in:
黎永顺 2024-08-20 09:23:41 +08:00
parent 96f6135aba
commit 63eb373025
1 changed files with 6 additions and 9 deletions

View File

@ -412,12 +412,10 @@ const StatisticalScopePicker = (props) => {
<WeaDatePicker
value={startDate} disabled={disabled}
disabledDate={(current) => {
console.log(current, moment(current).format("YYYY-MM"))
console.log(startDate, endDate)
if (!current || !endDate) return false;
const start = moment(startDate || endDate).subtract(11, "months").format("YYYY-MM");
const end = moment(startDate).add(12, "months").format("YYYY-MM");
return current.getTime() < new Date(start).getTime() || current.getTime() > new Date(endDate || end).getTime();
const tooEarly = moment(current.getTime()).isBefore(moment(endDate).subtract(12, "month"));
const tooLate = moment(current.getTime()).isAfter(moment(endDate));
return !!tooEarly || !!tooLate;
}}
format="YYYY-MM"
onChange={(val) => onChange([val, endDate], timeType)}
@ -428,10 +426,9 @@ const StatisticalScopePicker = (props) => {
value={endDate} disabled={disabled}
disabledDate={(current) => {
if (!current || !startDate) return false;
const start = moment(endDate).subtract(12, "months").format("YYYY-MM");
const end = moment(endDate || startDate).add(12, "months").format("YYYY-MM");
return current.getTime() > new Date(end).getTime() || current.getTime() < new Date(startDate || start).getTime();
const tooEarly = moment(current.getTime()).isAfter(moment(startDate).add(12, "month"));
const tooLate = moment(current.getTime()).isBefore(moment(startDate));
return !!tooEarly || !!tooLate;
}}
format="YYYY-MM"
viewAttr={viewAttr}