Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug/109038 When "Punch out to" is empty user receives error when exporting to excel #841

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ const InvitationsFilter = ({
};

const handleExportToExcel = async () => {
const { punchOutDateFromUtc, punchOutDateToUtc } = localFilter;
kslazykv marked this conversation as resolved.
Show resolved Hide resolved
setIsExporting(true);
try {
await exportInvitationsToExcel();
Expand All @@ -309,6 +310,16 @@ const InvitationsFilter = ({
setIsExporting(false);
}
};
const isButtonDisabled = () => {
const { punchOutDateFromUtc, punchOutDateToUtc } = localFilter;
if (punchOutDateFromUtc && !punchOutDateToUtc) {
return true;
}
if (punchOutDateFromUtc && punchOutDateToUtc) {
return new Date(punchOutDateFromUtc) > new Date(punchOutDateToUtc);
}
return false;
};

return (
<Container>
Expand All @@ -319,8 +330,8 @@ const InvitationsFilter = ({
variant="ghost"
title="Export filtered IPOs to Excel"
onClick={handleExportToExcel}
disabled={isExporting}
aria-disabled={isExporting ? true : false}
disabled={isExporting || isButtonDisabled()}
aria-disabled={isExporting || isButtonDisabled() ? true : false}
aria-label={isExporting ? 'loading data' : null}
>
{isExporting ? (
Expand Down
Loading