weeksInThisYear property

Iterable<Hora> get weeksInThisYear

Generates all weeks in the year.

Implementation

Iterable<Hora> get weeksInThisYear sync* {
  var current = Hora.of(year: year, locale: locale).startOfIsoWeek;

  // Move to first week of this year if needed
  if (current.isoWeekYear < year) {
    current = current.add(1, TemporalUnit.week);
  }

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