isBefore method

bool isBefore(
  1. IsoDuration other
)

Returns true if this IsoDuration occurs before the other.

Each IsoDuration is calculated as a sum of all properties and then the duration is compared.

Example:

final dur = IsoDuration(hours: 1, minutes: 30);
final dur2 = IsoDuration(hours: 10, minutes: 0);
dur.isAfter(dur2); // true

Implementation

bool isBefore(IsoDuration other) {
  if (this == other) return false;
  if (!isNegative && other.isNegative) return false;
  if (isNegative && !other.isNegative) return true;
  if (isPrecise && other.isPrecise) return toSeconds() < other.toSeconds();
  return !_isAfter(other);
}