isDateAfter function

IValidator isDateAfter(
  1. DateTime dt, {
  2. bool inclusive = false,
  3. String? message,
})

DateTime must be after (or equal if inclusive) given bound.

Implementation

IValidator isDateAfter(DateTime dt, {bool inclusive = false, String? message}) {
  return _datePredicate(
    defaultMessage:
        'a DateTime after${inclusive ? ' or equal to' : ''} ${dt.toIso8601String()}',
    test: (v) => inclusive ? !v.isBefore(dt) : v.isAfter(dt),
    code: ExpectationCodes.valueDateOutOfRange,
    dataBuilder: () => {
      'bound': dt.toIso8601String(),
      'op': 'after',
      'inclusive': inclusive,
    },
    message: message,
  );
}