WeekConfig constructor

const WeekConfig({
  1. int firstDayOfWeek = DateTime.monday,
  2. int minDaysInFirstWeek = 4,
})

Creates a week configuration.

firstDayOfWeek uses the same values as DateTime.monday (1) through DateTime.sunday (7).

minDaysInFirstWeek determines when the first week of the year starts:

  • 4 = ISO 8601 (first week must contain Thursday)
  • 1 = US convention (first week contains Jan 1)

Implementation

const WeekConfig({
  this.firstDayOfWeek = DateTime.monday,
  this.minDaysInFirstWeek = 4,
})  : assert(
        firstDayOfWeek >= 1 && firstDayOfWeek <= 7,
        'firstDayOfWeek must be 1 (Monday) through 7 (Sunday)',
      ),
      assert(
        minDaysInFirstWeek >= 1 && minDaysInFirstWeek <= 7,
        'minDaysInFirstWeek must be 1 through 7',
      );