Skip to content

Commit da7b9b2

Browse files
committed
bugfix: don't crash when creating a new invoice
1 parent 4ecc671 commit da7b9b2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

frontend/src/components/invoice/invoice-edit/EditInvoice.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ const EditInvoice = () => {
9595
const {invoice, setInvoice, originalInvoice, blocker, hasChanges, acceptChanges} = useInvoiceState(isQuotation);
9696
const config = useSelector((state: ConfacState) => state.config);
9797

98-
const isBeforePeppolPivot = moment(invoice.audit.createdOn).isBefore(config.peppolPivotDate, 'day');
98+
const isBeforePeppolPivot = invoice.audit?.createdOn
99+
? moment(invoice.audit.createdOn).isBefore(config.peppolPivotDate, 'day')
100+
: false;
99101

100102
// ATTN: invoice updated from somewhere else will now overwrite local changes
101103
useEntityChangedToast(invoice?._id);

0 commit comments

Comments
 (0)