getDayIndex function
Returns the index of a day throughout the week.
The day
input is expected to be from FitDateTimeExtension.getDate().
The index 0 is considered to be monday.
Implementation
int getDayIndex(String day) {
int index = 0;
switch (day.toLowerCase()) {
case "tuesday":
{
index = 1;
break;
}
case "wednesday":
{
index = 2;
break;
}
case "thursday":
{
index = 3;
break;
}
case "friday":
{
index = 4;
break;
}
case "saturday":
{
index = 5;
break;
}
case "sunday":
{
index = 6;
}
}
return index;
}