daysUntil method

Iterable<PersianDate> daysUntil(
  1. PersianDate end, {
  2. bool inclusive = true,
})

Every day from this date to end in order, date-only.

end is included unless inclusive is false. Empty when end is before this date. The sequence is lazy, so a long span costs nothing until it is iterated.

Implementation

Iterable<PersianDate> daysUntil(PersianDate end,
    {bool inclusive = true}) sync* {
  final last = end._julianDay - (inclusive ? 0 : 1);
  for (var jdn = _julianDay; jdn <= last; jdn++) {
    yield PersianDate._fromJulianDay(jdn);
  }
}