From 981a2c8f245d85c4c9b09f132c8ca6c5246f1071 Mon Sep 17 00:00:00 2001 From: CollinWoo Date: Sun, 3 Dec 2023 22:38:00 -0500 Subject: [PATCH] add documentation to formatAvail function --- frontend/src/components/EmployeeCards/EmployeeCards.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/frontend/src/components/EmployeeCards/EmployeeCards.tsx b/frontend/src/components/EmployeeCards/EmployeeCards.tsx index feca52cc7..05c2c7e90 100644 --- a/frontend/src/components/EmployeeCards/EmployeeCards.tsx +++ b/frontend/src/components/EmployeeCards/EmployeeCards.tsx @@ -77,6 +77,14 @@ const EmployeeCard = ({ const netId = email.split('@')[0]; const fmtPhone = formatPhone(phoneNumber); + /** + * Formats availability, represented by an object that maps available days to + * start and end times, into a printable string with availabilities formatted as '[day]: [start] - [end]'. + * Ignores malformed availabilities, e.g. missing start or end times, from being printed. + * + * @param availability the driver's availability, represented as an object map of days to start and end times + * @returns a string representation of a driver's availibility + */ const formatAvail = (availability: { [key: string]: { startTime: string; endTime: string }; }) => {