From 3da9e79e5d8f68564b3c9dc194786bcbff93acbb Mon Sep 17 00:00:00 2001 From: Lucieo Date: Fri, 1 Mar 2024 15:52:47 +0000 Subject: [PATCH] Fix company applications listing (#101) --- .../Account/Info/InfoCompanyApplications.tsx | 1 + web/utils/date.ts | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/web/components/Account/Info/InfoCompanyApplications.tsx b/web/components/Account/Info/InfoCompanyApplications.tsx index f22782c0..30654816 100644 --- a/web/components/Account/Info/InfoCompanyApplications.tsx +++ b/web/components/Account/Info/InfoCompanyApplications.tsx @@ -13,6 +13,7 @@ interface Props { const InfoCompanyApplications = ({ user }: Props) => { const { t } = useTranslation('account') const { currentCampaign } = useCampaignContext() + if (!currentCampaign) return null return ( diff --git a/web/utils/date.ts b/web/utils/date.ts index a2caa592..49eb48a6 100644 --- a/web/utils/date.ts +++ b/web/utils/date.ts @@ -4,10 +4,13 @@ import DateFnsFormat from 'date-fns/format' export const format = ( date: string | Date, formatDate: string = 'dd/MM/yyyy', -) => - DateFnsFormat(new Date(date), formatDate, { - locale: fr, - }) +) => { + if (date) { + return DateFnsFormat(new Date(date), formatDate, { + locale: fr, + }) + } +} export const orderByDate = (array: Record[], key: string) => { if (!array) return []