diff --git a/app/reports/reports_list.tsx b/app/reports/reports_list.tsx index 3a39777..013c2dd 100644 --- a/app/reports/reports_list.tsx +++ b/app/reports/reports_list.tsx @@ -6,6 +6,7 @@ import { getReports } from "@/api/reporting/reports"; import { ReportsListProps } from "../types"; import { MixpanelTracking } from "@/services/mixpanel"; import { MIXPANEL_EVENT } from "@/constants/config"; +import { formatDate } from "@/utils/dateUtils"; export default function ReportsList({ userId }: ReportsListProps) { const [responseData, setResponseData] = useState<{ reports: Report[] } | null>(null); @@ -37,7 +38,7 @@ export default function ReportsList({ userId }: ReportsListProps) {

{report.test_name}

-

Rank: {report.rank}

+

Date attempted: {formatDate(report.start_date) ?? "Date not available"}

))} diff --git a/app/types.ts b/app/types.ts index 17ba179..cb7e20f 100644 --- a/app/types.ts +++ b/app/types.ts @@ -25,6 +25,7 @@ export interface Report { test_name: string; rank: string; report_link: string; + start_date: string; }; export interface PrimaryButton { diff --git a/utils/dateUtils.ts b/utils/dateUtils.ts index 7e599cd..bf5fc33 100644 --- a/utils/dateUtils.ts +++ b/utils/dateUtils.ts @@ -54,3 +54,9 @@ export function isSessionActive(endTime: string): boolean { const currentTimeObj = new Date(`2000-01-01T${currentTimeStr}`); return sessionEndTime.getTime() > currentTimeObj.getTime(); } + +export function formatDate(dateStr: string): string { + const [year, month, day] = dateStr.split('-'); + return `${day}-${month}-${year}`; +} +