getMonthViewLineCount static method

int getMonthViewLineCount(
  1. int year,
  2. int month,
  3. int offset
)

月的行数

Implementation

static int getMonthViewLineCount(int year, int month, int offset) {
  DateTime firstDayOfMonth = new DateTime(year, month, 1);
  int monthDayCount = getMonthDaysCount(year, month);

  int preIndex = (firstDayOfMonth.weekday - 1 + offset) % 7;
  int lineCount = ((preIndex + monthDayCount) / 7).ceil();
  LogUtil.log(
      TAG: "DateUtil",
      message: "getMonthViewLineCount:$year年$month月:有$lineCount行");

  return lineCount;
}