getIndexOfFirstDayInMonth static method

int getIndexOfFirstDayInMonth(
  1. DateTime dateTime, {
  2. int offset = 0,
})

本月第一天,是那一周的第几天,从1开始 @return 获取日期所在月视图对应的起始偏移量 the start diff with MonthView

Implementation

static int getIndexOfFirstDayInMonth(DateTime dateTime, {int offset = 0}) {
  DateTime firstDayOfMonth = new DateTime(dateTime.year, dateTime.month, 1);

  int week = firstDayOfMonth.weekday + offset;

  return week;
}