getMonthDays method

  1. @override
Map getMonthDays(
  1. WeekDayStringTypes type,
  2. int index
)
override

Implementation

@override
Map getMonthDays(WeekDayStringTypes type, int index) {
  Map days = {};
  CalendarDateTime now = _getSelectedDate();
  int monthLength = DateTime(now.year, index + 1, 0).day;
  DateTime firstDayOfMonth = DateTime(now.year, index, 1);
  int dayIndex = firstDayOfMonth.weekday;

  switch (type) {
    case WeekDayStringTypes.FULL:
      for (var i = 1; i <= monthLength; i++) {
        days[i] = Translator.getFullNameOfDays()[dayIndex % 7];
        dayIndex++;
      }
      break;
    case WeekDayStringTypes.SHORT:
      for (var i = 1; i <= monthLength; i++) {
        days[i] = Translator.getShortNameOfDays()[dayIndex % 7];
        dayIndex++;
      }
      break;
  }
  return days;
}