function lessOrGreater(value, format, maxDate, minDate) {
  let message = '';
  let result = true;

  if (maxDate && value.isValid()) {
    const maxDateMoment = moment(maxDate, format);

    if (value >  maxDateMoment) {
      message = CALENDAR_ERROR_MESSAGES.greater(maxDateMoment, format);
      result = false;
    }
  }

  if (minDate && value.isValid()) {
    const minDateMoment = moment(minDate, format);

    if (value < minDateMoment) {
      message = CALENDAR_ERROR_MESSAGES.less(minDateMoment, format);
      result = false;
    }
  }

  return {
    message,
    result
  };
}
Checks the value for a min date and max date.
@param {moment} value
  The value to check.
@param {[string]} format
  A moment formats.
@param {Date} maxDate
  The max date.
@param {Date} minDate
  The min date.
@returns {{message: string, result: boolean}} - The response object.