weekNumber property

int get weekNumber

The week number based on western traditional system, 1 .. 53. The week contains January 1st corresponds to week number 1.

Implementation

int get weekNumber {
  final lastDayOfWeek = DateTime(year, month, day + 7 - weekdayFromSunday);
  return (lastDayOfWeek.ordinalDate - lastDayOfWeek.weekdayFromSunday + 13) ~/
      7;
}