This repository has been archived on 2022-05-20. You can view files and clone it, but cannot push or open issues or pull requests.
Alley-HSBC-Frontend/src/components/contacts/Utils.tsx
2022-03-20 23:56:18 -07:00

22 lines
558 B
TypeScript

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 };