datesEqualAtResolution function

bool datesEqualAtResolution(
  1. Date? a,
  2. Date? b,
  3. CalendarResolution resolution
)

Implementation

bool datesEqualAtResolution(Date? a, Date? b, CalendarResolution resolution) {
  switch (resolution) {
    case CalendarResolution.years:
      return a!.year == b!.year;
    case CalendarResolution.months:
      return a!.year == b!.year && a.month == b.month;
    case CalendarResolution.days:
      return a == b;
    case CalendarResolution.weeks:
    default:
      throw ArgumentError('Equality not supported at resolution: $resolution');
  }
}