diff --git a/app/page.tsx b/app/page.tsx index b3387fd..4ff7b71 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -19,7 +19,7 @@ export default function Home() { const [liveClasses, setLiveClasses] = useState([]); const [isLoading, setIsLoading] = useState(true); const [quizzes, setQuizzes] = useState([]); - const commonTextClass = "text-gray-700 text-sm md:text-base mx-6 md:mx-8"; + const commonTextClass = "text-gray-700 text-xs md:text-sm mx-3 md:mx-8 whitespace-nowrap w-12"; const infoMessageClass = "flex items-center justify-center text-center h-72 mx-4 pb-40"; const portalBaseUrl = api.portal.frontend.baseUrl; const [batchId, setBatchId] = useState(); @@ -105,7 +105,7 @@ export default function Home() { return (

Starts at
- {sessionStartTimeStr} + {formatTime(sessionStartTimeStr)}

); } @@ -122,7 +122,7 @@ export default function Home() { return (

Starts at
- {sessionStartTimeStr} + {formatTime(sessionStartTimeStr)}

); } @@ -204,10 +204,10 @@ export default function Home() {

- {formatQuizSessionTime(data.start_time)} + {formatTime(formatQuizSessionTime(data.start_time))}

- {formatQuizSessionTime(data.end_time)} + {formatTime(formatQuizSessionTime(data.end_time))}

diff --git a/utils/dateUtils.ts b/utils/dateUtils.ts index bf5fc33..809f1c2 100644 --- a/utils/dateUtils.ts +++ b/utils/dateUtils.ts @@ -43,8 +43,8 @@ export function formatQuizSessionTime(dateTimeStr: string) { } export function formatTime(dateTimeStr: string) { - const [hours, minutes] = dateTimeStr.split(':'); - return `${hours}:${minutes}`; + const time = new Date(`2000-01-01T${dateTimeStr}`); + return time.toLocaleTimeString('en-US', { hour: 'numeric', minute: '2-digit', hour12: true }); } export function isSessionActive(endTime: string): boolean {