diff --git a/src/components/meeting-details/meeting-details-components/Body.tsx b/src/components/meeting-details/meeting-details-components/Body.tsx index 7a3f218..936b0c3 100644 --- a/src/components/meeting-details/meeting-details-components/Body.tsx +++ b/src/components/meeting-details/meeting-details-components/Body.tsx @@ -48,6 +48,7 @@ const Body: React.FC = ({ meeting }) => { ); const parseIsoString = (s: string) => { + const date: Date = new Date(s); const month = [ "January", "February", @@ -61,10 +62,13 @@ const Body: React.FC = ({ meeting }) => { "October", "November", "December", - ][parseInt(s.slice(5, 7)) - 1]; - const day = s.slice(8, 10); - const isoTime: string = s.slice(11, 16); - const hour: number = parseInt(isoTime.slice(0, 2)); + ][date.getMonth()]; + // ][parseInt(s.slice(5, 7)) - 1]; + // const day = s.slice(8, 10); + // const isoTime: string = s.slice(11, 16); + // const hour: number = parseInt(isoTime.slice(0, 2)); + const day = date.getDate(); + const hour: number = date.getHours(); const hourMod: string = hour % 12 == 0 ? "12" : (hour % 12).toString(); return ( month + @@ -73,7 +77,8 @@ const Body: React.FC = ({ meeting }) => { ", " + hourMod + ":" + - isoTime.slice(3, 5) + + // isoTime.slice(3, 5) + + date.getMinutes() + (hour > 11 ? "PM" : "AM") ); }; diff --git a/src/utils.tsx b/src/utils.tsx index e537354..23fa769 100644 --- a/src/utils.tsx +++ b/src/utils.tsx @@ -21,14 +21,9 @@ const getStatusColor = (ms: MeetingStatus): string => { const formatTimeFromDate = (date: Date): string => { let hour = date.getHours(); let ampm = ""; - const minutes = - date.getMinutes() < 10 ? "0" + date.getMinutes() : "" + date.getMinutes(); - if (hour < 12) { - ampm = "am"; - } else { - hour = hour === 12 ? 12 : hour - 12; - ampm = "pm"; - } + const minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : "" + date.getMinutes(); + ampm = hour < 12 ? "AM" : "PM"; + hour = hour % 12 == 0 ? 12 : (hour % 12); return hour + ":" + minutes + ampm; };