weeksInThisYear property

Iterable<Hora> get weeksInThisYear

Generates all ISO week start dates in the current year.

Implementation

Iterable<Hora> get weeksInThisYear sync* {
  if (!isValid) {
    throw StateError('weeksInThisYear requires a valid Hora instance.');
  }

  var current =
      Hora.of(year: year, utc: isUtc, locale: locale).startOfIsoWeek;

  if (current.isoWeekYear < year) {
    current = current.add(1, TemporalUnit.week);
  }

  while (current.isoWeekYear == year) {
    yield current;
    current = current.add(1, TemporalUnit.week);
  }
}