function getEndOfWeekIndex(weekStartsOn) {
  const weekEndsOn = weekStartsOn === 0 ? 6 : weekStartsOn - 1;

  return weekEndsOn;
}
Helper to find out what day the week ends on given the localized start of the week
@param {Number} weekStartsOn - the index of the first day of the week (from 0 to 6)
@return {Number} - Returns the index of the day the week ends on