import DetailedMeeting from "../../api-bodies/DetailedMeeting";

const getUpcomingMeetingTime = (meeting: DetailedMeeting) => {
  const startDate = new Date(meeting.start);
  const endDate = new Date(startDate.getTime() + meeting.duration * 60000);
  const startTime = startDate
    .toTimeString()
    .split(" ")[0]
    .split(":")
    .slice(0, 2)
    .join(":");
  const endTime = endDate
    .toTimeString()
    .split(" ")[0]
    .split(":")
    .slice(0, 2)
    .join(":");
  return `${startTime} - ${endTime}`;
};

export { getUpcomingMeetingTime };
