isBeforeOrEqualFn method

FieldValidator<T, TimeOfDay> isBeforeOrEqualFn(
  1. ValueGetter<TimeOfDay> other, [
  2. MessageCallBack<TimeOfDay>? message
])

check if the value is before other or at the same moment

Implementation

FieldValidator<T, TimeOfDay> isBeforeOrEqualFn(ValueGetter<TimeOfDay> other,
    [MessageCallBack<TimeOfDay>? message]) {
  return next((messages, value) {
    var oth = other();
    if (!value.isBefore(oth) && !value.isAtSameMomentAs(oth)) {
      return message?.call(messages, value) ??
          messages.isTimeBeforeOrEqual(_dateTime(oth));
    }
    return null;
  });
}