diff --git a/src/components/home/MeetingsPanel.tsx b/src/components/home/MeetingsPanel.tsx index 4a9f599..2767101 100644 --- a/src/components/home/MeetingsPanel.tsx +++ b/src/components/home/MeetingsPanel.tsx @@ -25,13 +25,21 @@ const MeetingsPanel: React.FC = () => { const meetingMembers = useAppSelector((state) => selectUsers(state, meeting.liveParticipantIds) ); - return ( - (" " + userLite.name + " ")).toString()} - /> - ); + const startDate = new Date(meeting.start); + const startDatemil = startDate.getTime(); + const endDatemil = startDatemil + meeting.duration*60000; + const endDate = new Date(endDatemil); + const currentDatemil = Date.now(); + + if (currentDatemil >= startDatemil && currentDatemil <= endDatemil) { + return ( + (" " + userLite.name + " ")).toString()} + /> + ); + } })} ); diff --git a/src/utils.tsx b/src/utils.tsx index 6c5d141..6dbb3d5 100644 --- a/src/utils.tsx +++ b/src/utils.tsx @@ -14,11 +14,10 @@ const getStatusColor = (ms: MeetingStatus): string => { } }; -const formatTimeFromDate = (date: Date, offsetMinutes: number): string => { - const newDate = new Date(date.getTime() + offsetMinutes*60000); - let hour = newDate.getHours(); +const formatTimeFromDate = (date: Date): string => { + let hour = date.getHours(); let ampm = ""; - let minutes = newDate.getMinutes() < 10 ? "0" + newDate.getMinutes() : "" + newDate.getMinutes(); + let minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : "" + date.getMinutes(); if (hour < 12) { ampm = "am"; } else {