Skip to content

Commit 9d1ee2f

Browse files
committed
handle Invalid Date
1 parent b06f11e commit 9d1ee2f

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

components/hearing/HearingSidebar.tsx

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ export const HearingSidebar = ({
5757
day: "2-digit",
5858
year: "numeric"
5959
})
60+
let dateCheck = false
61+
if (formattedDate !== `Invalid Date`) {
62+
dateCheck = true
63+
}
6064

6165
const [houseChairName, setHouseChairName] = useState<string>("")
6266
const [houseChairperson, setHouseChairperson] = useState<Legislator>()
@@ -110,12 +114,16 @@ export const HearingSidebar = ({
110114
{t("hearing_details")}
111115
</SidebarHeader>
112116

113-
<SidebarBody className={`border-bottom fs-6 fw-bold px-3 py-3`}>
114-
<SidebarSubbody className={`mb-1`}>
115-
{t("recording_date")}
116-
</SidebarSubbody>
117-
<div className={`fw-normal`}>{formattedDate}</div>
118-
</SidebarBody>
117+
{dateCheck ? (
118+
<SidebarBody className={`border-bottom fs-6 fw-bold px-3 py-3`}>
119+
<SidebarSubbody className={`mb-1`}>
120+
{t("recording_date")}
121+
</SidebarSubbody>
122+
<div className={`fw-normal`}>{formattedDate}</div>
123+
</SidebarBody>
124+
) : (
125+
<></>
126+
)}
119127

120128
{committeeCode && (
121129
<SidebarBody

0 commit comments

Comments
 (0)