isBefore method

ValidatorFn<DateTime> isBefore(
  1. DateTime max, [
  2. String? message
])

A date before validator.

Implementation

ValidatorFn<DateTime> isBefore(DateTime max, [String? message]) {
  return (DateTime? value, BuildContext context) {
    if (value != null && value.isAfter(max)) {
      return message ?? HookFormScope.of(context).dateBefore(max);
    }

    return this.call(value, context);
  };
}