inRangePlus method

bool inRangePlus(
  1. DateTime from,
  2. DateTime to,
  3. DateTime compare
)

check if dates are in range and is the same month and year of the current date displayed in the calendar

Implementation

bool inRangePlus(DateTime from, DateTime to, DateTime compare) {
  DateTime initDay = compare.subtract(Duration(days: compare.day - 1));
  return ((from.month < compare.month && to.month > compare.month) &&
          (from.year == compare.year && to.year == compare.year))
      ? true
      : (inRange(from, to, initDay) || inRange(from, to, compare)) ||
          (inRange(initDay, compare, from) && inRange(initDay, compare, to));
}