equalTo method

JarDate equalTo(
  1. String field, [
  2. String? message
])

Implementation

JarDate equalTo(String field, [String? message]) {
  return addValidator((value) {
    if (value == null) return null;
    final otherValue = getFieldValue(field);
    if (otherValue is! DateTime?) return null;
    return value.isAtSameMomentAs(otherValue!)
        ? null
        : (message ?? 'Must be equal to $field');
  });
}