Skip to content

Commit 1531aa1

Browse files
authored
Fix Bill History Scraper (#2123)
* allow date to be nullable on billHistory items * formatting
1 parent cd92e61 commit 1531aa1

3 files changed

Lines changed: 4 additions & 10 deletions

File tree

components/bill/HistoryTable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const BillHistoryActionRows = ({ billHistory }: HistoryProps) => {
3737
return (
3838
<tr key={index}>
3939
<td>
40-
{Date.substring(5, 10)}-{Date.substring(0, 4)}
40+
{Date ? `${Date.substring(5, 10)}-${Date.substring(0, 4)}` : ""}
4141
</td>
4242
<td>
4343
<LinkConnectedBills action={Action} />

components/bill/Status.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,8 @@ export const Status = ({ bill }: BillProps) => {
3838
hearingCheck = true
3939
}
4040

41-
let hearingDate = ""
42-
if (history?.Date) {
43-
hearingDate = history.Date
44-
}
45-
let dateCheck = false
46-
if (hearingDate < today) {
47-
dateCheck = true
48-
}
41+
const hearingDate = history?.Date ?? ""
42+
const dateCheck = !!hearingDate && hearingDate < today
4943

5044
if (!history) return null
5145
return (

functions/src/bills/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const BillReference = Record({
1919

2020
export type BillHistoryAction = Static<typeof BillHistoryAction>
2121
export const BillHistoryAction = Record({
22-
Date: String,
22+
Date: Nullable(String),
2323
Branch: String,
2424
Action: String
2525
})

0 commit comments

Comments
 (0)