diff --git a/pc4mobx/hrmSalary/pages/reportView/components/statisticalMicroSettingsSlide.js b/pc4mobx/hrmSalary/pages/reportView/components/statisticalMicroSettingsSlide.js index 66a38aeb..e82f2eaa 100644 --- a/pc4mobx/hrmSalary/pages/reportView/components/statisticalMicroSettingsSlide.js +++ b/pc4mobx/hrmSalary/pages/reportView/components/statisticalMicroSettingsSlide.js @@ -412,12 +412,10 @@ const StatisticalScopePicker = (props) => { { - 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}