Skip to content

Commit

Permalink
add documentation to getRecurringDays function
Browse files Browse the repository at this point in the history
  • Loading branch information
CollinWoo committed Nov 15, 2023
1 parent b079900 commit d5f9446
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion frontend/src/components/RideModal/RideModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,24 @@ const RideModal = ({ open, close, ride, editSingle }: RideModalProps) => {

const submitData = () => setIsSubmitted(true);

/**
* Converts a ride that repeats into a number array representation used by
* the internal representation of a ride
*
* @param date a string representation of the ride start date
* @param repeats an enum representing how often this ride repeats: Daily,
* Weekly, or Custom
* @param days Used if the ride repeats on custom days. An object that
* maps days (Mon, Tue, Wed, Thur, Fri) to strings, where the string value is
* non-empty if the ride repeats on that day
* @returns a number array containing the days of the week where the ride repeats,
* with Monday represented as 1, Tuesday represented as 2, etc.
*/
const getRecurringDays = (
date: string,
repeats: RepeatValues,
days: ObjectType
) => {
) : number[] => {
switch (repeats) {
case RepeatValues.Daily:
return [1, 2, 3, 4, 5];
Expand Down

0 comments on commit d5f9446

Please sign in to comment.