MonthRange constructor

MonthRange(
  1. DateTime start,
  2. DateTime stop, [
  3. int stepInMonths = 1
])

Implementation

factory MonthRange(DateTime start, DateTime stop, [int stepInMonths = 1]) {
  if (stepInMonths <= 0) {
    throw ArgumentError.value(
        stepInMonths, 'stepInMonths', 'Must be greater than 0');
  }

  if (stop.isBefore(start)) stepInMonths = -stepInMonths;
  return MonthRange._(start, stop, stepInMonths);
}