firstDayOfWeek property

DateTime firstDayOfWeek

Implementation

DateTime get firstDayOfWeek {
  /// Handle Daylight Savings by setting hour to 12:00 Noon
  /// rather than the default of Midnight
  final day = DateTime.utc(this.year, this.month, this.day, 12);

  /// Weekday is on a 1-7 scale Monday - Sunday,
  /// This Calendar works from Sunday - Monday
  var decreaseNum = day.weekday % 7;
  return this.subtract(Duration(days: decreaseNum));
}