|
|
|
@@ -52,11 +52,10 @@ const SummaryForm = ({ searchCriteria, issueComboData}) => { |
|
|
|
setWaitDownload(true); |
|
|
|
setDateRangeError(""); |
|
|
|
|
|
|
|
// ---- 90-day validation (run on Export click) ---- |
|
|
|
// ---- Payment date validation (run on Export click) ---- |
|
|
|
const from = dayjs(minDate); |
|
|
|
const to = dayjs(maxDate); |
|
|
|
|
|
|
|
// If both dates are expected/required, validate both exist + range |
|
|
|
if (!from.isValid() || !to.isValid()) { |
|
|
|
setDateRangeError("Please select both Payment Date (From) and Payment Date (To)."); |
|
|
|
setWaitDownload(false); |
|
|
|
@@ -64,13 +63,6 @@ const SummaryForm = ({ searchCriteria, issueComboData}) => { |
|
|
|
} |
|
|
|
|
|
|
|
const diffDays = to.startOf("day").diff(from.startOf("day"), "day"); |
|
|
|
if (diffDays > 1000) { |
|
|
|
setDateRangeError("Payment Date (From) and Payment Date (To) must be within 1000 days."); |
|
|
|
setWaitDownload(false); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
// Optional: if you want to disallow negative ranges (should already be prevented by min/maxDate) |
|
|
|
if (diffDays < 0) { |
|
|
|
setDateRangeError("Payment Date (To) must be on or after Payment Date (From)."); |
|
|
|
setWaitDownload(false); |
|
|
|
|