TimezoneRange constructor

TimezoneRange({
  1. required HoraZoned start,
  2. required HoraZoned end,
  3. required HoraTimezone timezone,
})

Implementation

TimezoneRange({
  required this.start,
  required this.end,
  required this.timezone,
}) {
  if (start.timezone != timezone || end.timezone != timezone) {
    throw ArgumentError(
      'start/end timezone must match range timezone.',
    );
  }
  if (end.instantUtc.isBefore(start.instantUtc)) {
    throw ArgumentError(
      'Range end must be the same as or after start instant.',
    );
  }
}