Skip to content

Commit

Permalink
add documentation to formatAvail function
Browse files Browse the repository at this point in the history
  • Loading branch information
CollinWoo committed Dec 4, 2023
1 parent b4a1744 commit 981a2c8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions frontend/src/components/EmployeeCards/EmployeeCards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
}) => {
Expand Down

0 comments on commit 981a2c8

Please sign in to comment.