diff --git a/components/bill/HistoryTable.tsx b/components/bill/HistoryTable.tsx index 04335eebf..ad5445242 100644 --- a/components/bill/HistoryTable.tsx +++ b/components/bill/HistoryTable.tsx @@ -37,7 +37,7 @@ const BillHistoryActionRows = ({ billHistory }: HistoryProps) => { return ( - {Date.substring(5, 10)}-{Date.substring(0, 4)} + {Date ? `${Date.substring(5, 10)}-${Date.substring(0, 4)}` : ""} diff --git a/components/bill/Status.tsx b/components/bill/Status.tsx index 42226395f..317541838 100644 --- a/components/bill/Status.tsx +++ b/components/bill/Status.tsx @@ -38,14 +38,8 @@ export const Status = ({ bill }: BillProps) => { hearingCheck = true } - let hearingDate = "" - if (history?.Date) { - hearingDate = history.Date - } - let dateCheck = false - if (hearingDate < today) { - dateCheck = true - } + const hearingDate = history?.Date ?? "" + const dateCheck = !!hearingDate && hearingDate < today if (!history) return null return ( diff --git a/functions/src/bills/types.ts b/functions/src/bills/types.ts index 33b5420f8..c75e8787a 100644 --- a/functions/src/bills/types.ts +++ b/functions/src/bills/types.ts @@ -19,7 +19,7 @@ export const BillReference = Record({ export type BillHistoryAction = Static export const BillHistoryAction = Record({ - Date: String, + Date: Nullable(String), Branch: String, Action: String })