diff --git a/components/bill/Status.tsx b/components/bill/Status.tsx index b672769fd..42226395f 100644 --- a/components/bill/Status.tsx +++ b/components/bill/Status.tsx @@ -24,6 +24,28 @@ export const Status = ({ bill }: BillProps) => { const handleShowBillHistory = () => setShowBillHistory(true) const handleCloseBillHistory = () => setShowBillHistory(false) const history = last(bill.history) + const today = new Date().toISOString() + + // revisit this when we revisit translations for the backend + const target1 = "Hearing scheduled for " + const target2 = "Hearing rescheduled to " + + let hearingCheck = false + if ( + history?.Action.startsWith(target1) || + history?.Action.startsWith(target2) + ) { + hearingCheck = true + } + + let hearingDate = "" + if (history?.Date) { + hearingDate = history.Date + } + let dateCheck = false + if (hearingDate < today) { + dateCheck = true + } if (!history) return null return ( @@ -34,7 +56,7 @@ export const Status = ({ bill }: BillProps) => { className="text-truncate ps-4" onClick={handleShowBillHistory} > - {history.Action} + {hearingCheck && dateCheck ? t("bill.hearing_held") : history.Action} diff --git a/public/locales/en/common.json b/public/locales/en/common.json index a0a3d5fe2..8ad0918c4 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -23,8 +23,9 @@ "disclosure_date": "Disclosure Date", "download_pdf": "Download PDF", "example_name": "Example Name", + "hearing_held": "Hearing Held", "hearing_scheduled_for": "Hearing Scheduled for {{date, datetime(year: 'numeric'; month: 'long'; day: 'numeric'; hour: 'numeric'; minute: 'numeric')}}", - "hearing_video_and_transcript" : "Hearing Video + Transcript", + "hearing_video_and_transcript" : "Hearing Video + Transcript", "history": "History", "icon": { "commerce": "Commerce",