diff --git a/src/routes/home/+page.svelte b/src/routes/home/+page.svelte index e2c885ba..60037c60 100644 --- a/src/routes/home/+page.svelte +++ b/src/routes/home/+page.svelte @@ -39,6 +39,21 @@ return 0; } +function formatTime(timeString) { + // Split the time string into components + const [hours, minutes, seconds] = timeString.split(':').map(Number); + + // Determine AM or PM + const period = hours >= 12 ? 'PM' : 'AM'; + + // Convert hours from 24-hour to 12-hour format + const formattedHours = hours % 12 || 12; // Converts 0 to 12 for midnight + + // Format the time string + const formattedTimeString = `${formattedHours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')} ${period}`; + + return formattedTimeString; +} function reformatDate(dateString) { return dateString.substring(5, 7) + '/' + dateString.substring(8) + '/' + dateString.substring(2, 4); @@ -403,7 +418,7 @@ onMount( async() => {