getIndexDayInWeek static method

int getIndexDayInWeek(
  1. DateTime dateTime
)

本周的第几天

Implementation

static int getIndexDayInWeek(DateTime dateTime) {
  DateTime firstdayInMonth = new DateTime(
    dateTime.year,
    dateTime.month,
  );
  Duration duration = dateTime.difference(firstdayInMonth);
  // return (duration.inDays / 7).toInt() + 1;
  return (duration.inDays ~/ 7) + 1;
}