From d4e8b81ec13cf413142d1024492283aa933c07c1 Mon Sep 17 00:00:00 2001 From: Daniel Bisgrove Date: Mon, 14 Oct 2024 16:51:16 -0400 Subject: [PATCH] Remove all nonNulls --- .../financialEntries/financialEntries.graphql | 2 +- .../AccountTransactionTable.tsx | 12 +++++++++--- .../AccountTransactions/AccountTransactions.tsx | 4 +++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/pages/api/Schema/reports/financialAccounts/financialEntries/financialEntries.graphql b/pages/api/Schema/reports/financialAccounts/financialEntries/financialEntries.graphql index 06c3fecd8..219551ea0 100644 --- a/pages/api/Schema/reports/financialAccounts/financialEntries/financialEntries.graphql +++ b/pages/api/Schema/reports/financialAccounts/financialEntries/financialEntries.graphql @@ -23,7 +23,7 @@ type FinancialAccountEntry { currency: String code: String description: String - entryDate: ISO8601Date! + entryDate: ISO8601Date type: String category: FinancialAccountCategory! } diff --git a/src/components/Reports/FinancialAccountsReport/AccountTransactions/AccountTransactionTable/AccountTransactionTable.tsx b/src/components/Reports/FinancialAccountsReport/AccountTransactions/AccountTransactionTable/AccountTransactionTable.tsx index f00cb8bc8..e5e96a544 100644 --- a/src/components/Reports/FinancialAccountsReport/AccountTransactions/AccountTransactionTable/AccountTransactionTable.tsx +++ b/src/components/Reports/FinancialAccountsReport/AccountTransactions/AccountTransactionTable/AccountTransactionTable.tsx @@ -70,7 +70,7 @@ interface TransactionRow { currency?: Maybe; expenseAmount?: Maybe; incomeAmount?: Maybe; - entryDate: DateTime; + entryDate: DateTime | string; } const createTransactionRow = ( @@ -86,7 +86,9 @@ const createTransactionRow = ( ...amounts, categoryName: entry.category.name ?? entry.category.code ?? '', categoryCode: entry.category.code ?? '', - entryDate: DateTime.fromISO(entry.entryDate), + entryDate: entry.entryDate + ? DateTime.fromISO(entry.entryDate) + : 'No entry date', }; }; @@ -187,7 +189,11 @@ export const AccountTransactionTable: React.FC = ({ }, [entries, currency, openingBalance, closingBalance, activeFilters]); const Date: RenderCell = ({ row }) => ( - {dateFormatShort(row.entryDate, locale)} + + {typeof row.entryDate === 'string' + ? row.entryDate + : dateFormatShort(row.entryDate, locale)} + ); const Category: RenderCell = ({ row }) => ( diff --git a/src/components/Reports/FinancialAccountsReport/AccountTransactions/AccountTransactions.tsx b/src/components/Reports/FinancialAccountsReport/AccountTransactions/AccountTransactions.tsx index 617e55035..336f890a1 100644 --- a/src/components/Reports/FinancialAccountsReport/AccountTransactions/AccountTransactions.tsx +++ b/src/components/Reports/FinancialAccountsReport/AccountTransactions/AccountTransactions.tsx @@ -120,7 +120,9 @@ export const AccountTransactions: React.FC = () => { ]; const convertDataToArray = data.financialAccountEntries.entries.map( (entry) => [ - dateFormatShort(DateTime.fromISO(entry.entryDate), locale), + entry.entryDate + ? dateFormatShort(DateTime.fromISO(entry.entryDate), locale) + : 'No entry date', entry.description ?? '', entry.category?.name ?? entry.category?.code ?? '', entry.type === FinancialAccountEntryTypeEnum.Debit