validateDateIsInTheFuture function

void validateDateIsInTheFuture(
  1. TZDateTime scheduledDate,
  2. DateTimeComponents? matchDateTimeComponents
)

Helper method for validating a date/time value represents a future point in time where matchDateTimeComponents is null.

Implementation

void validateDateIsInTheFuture(
  TZDateTime scheduledDate,
  DateTimeComponents? matchDateTimeComponents,
) {
  if (matchDateTimeComponents != null) {
    return;
  }
  if (scheduledDate.isBefore(clock.now())) {
    throw ArgumentError.value(
        scheduledDate, 'scheduledDate', 'Must be a date in the future');
  }
}