Skip to content

Commit

Permalink
Merge pull request #3663 from Emurgo/denis/yoext-733/fixed-conditions
Browse files Browse the repository at this point in the history
Fixed conditions for disabling the export button
  • Loading branch information
vsubhuman committed Sep 30, 2024
2 parents 68d9026 + 92280a0 commit ab22417
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { DatePicker } from '@mui/x-date-pickers/DatePicker';
import { observer } from 'mobx-react';
import { defineMessages, intlShape } from 'react-intl';
import type { $npm$ReactIntl$IntlFormat } from 'react-intl';
import moment from 'moment';

const messages = defineMessages({
startDate: {
Expand Down Expand Up @@ -71,7 +70,6 @@ export default class ExportTransactionDialog extends Component<Props> {
key={id}
label={intl.formatMessage(label)}
value={value}
maxDate={moment()} // Today
minDate={minDate}
onChange={setDateHandler}
slotProps={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,15 @@ class ExportTransactionDialog extends Component<Props & InjectedLayoutProps, Sta
</Box>
);

const startDateIsCorrect = startDate !== null && startDate.isValid() && startDate.isSameOrBefore(endDate);
const endDateIsCorrect = endDate !== null && endDate.isValid();

const dialogActions = [
{
label: intl.formatMessage(globalMessages.exportButtonLabel),
primary: true,
isSubmitting: isActionProcessing || false,
disabled: !startDate || !endDate || startDate.isAfter(endDate) || !startDate.isValid() || !endDate.isValid(),
disabled: !startDateIsCorrect || !endDateIsCorrect,
onClick: () => submit({ startDate, endDate }),
},
];
Expand Down

0 comments on commit ab22417

Please sign in to comment.