Makes sure the date the user entered is within the valid range

If the time is not within the valid range, this method attaches an
error message to this time entry.
484138
protected function validateRanges()
    {
        if (!$this->isStartTimeValid()) {
            $message = sprintf(
                Swat::_(
                    'The time you have entered is invalid. ' .
                        'It must be on or after %s.'
                ),
                $this->getFormattedTime($this->valid_range_start)
            );

            $this->addMessage(new SwatMessage($message, 'error'));
        } elseif (!$this->isEndTimeValid()) {
            $message = sprintf(
                Swat::_(
                    'The time you have entered is invalid. ' .
                        'It must be on or before %s.'
                ),
                $this->getFormattedTime($this->valid_range_end)
            );

            $this->addMessage(new SwatMessage($message, 'error'));
        }
    }
615667
private void validateTimes(int idx, SubPicture subPic,
			SubPicture subPicNext, SubPicture subPicPrev) {
		long startTime = subPic.getStartTime();
		long endTime = subPic.getEndTime();
		final long delay = 5000 * 90; // default delay for missing end time (5
										// seconds)

		idx += 1; // only used for display

		// get end time of last frame
		long lastEndTime = subPicPrev != null ? subPicPrev.getEndTime() : -1;

		if (startTime < lastEndTime) {
			startTime = lastEndTime;
		}

		// get start time of next frame
		long nextStartTime = subPicNext != null ? subPicNext.getStartTime() : 0;

		if (nextStartTime == 0) {
			if (endTime > startTime) {
				nextStartTime = endTime;
			} else {
				// completely messed up:
				// end time and next start time are invalid
				nextStartTime = startTime + delay;
			}
		}

		if (endTime <= startTime) {
			endTime = startTime + delay;
			if (endTime > nextStartTime) {
				endTime = nextStartTime;
			}
		} else if (endTime > nextStartTime) {
			endTime = nextStartTime;
		}

		int minTimePTS = configuration.getMinTimePTS();
		if (endTime - startTime < minTimePTS) {
			if (configuration.getFixShortFrames()) {
				endTime = startTime + minTimePTS;
				if (endTime > nextStartTime) {
					endTime = nextStartTime;
				}
			}
		}

		if (subPic.getStartTime() != startTime) {
			subPic.setStartTime(SubtitleUtils.syncTimePTS(startTime,
					configuration.getFpsTrg(), configuration.getFpsTrg()));
		}
		if (subPic.getEndTime() != endTime) {
			subPic.setEndTime(SubtitleUtils.syncTimePTS(endTime,
					configuration.getFpsTrg(), configuration.getFpsTrg()));
		}
	}
314769
def _is_valid_date_time(self, inpt, metadata):
        """"""
        # NEED TO ADD CHECKS FOR OTHER METADATA, LIKE MINIMUM, MAXIMUM, ETC.
        from dlkit.abstract_osid.calendaring.primitives import DateTime as abc_datetime
        if isinstance(inpt, abc_datetime):
            return True
        else:
            return False
612829
def validate_q_time(self, value):
        
        if value:
            try:
                range = utils.parse_datetime_range_to_solr(value)
                return range
            except Exception as e:
                raise serializers.ValidationError(e.message)

        return value
803050
private void validateFinishDate(Task task)
   {
      if (task.getFinish() == null)
      {
         Date startDate = task.getStart();
         if (startDate != null)
         {
            if (task.getMilestone())
            {
               task.setFinish(startDate);
            }
            else
            {
               Duration duration = task.getDuration();
               if (duration != null)
               {
                  ProjectCalendar calendar = task.getEffectiveCalendar();
                  task.setFinish(calendar.getDate(startDate, duration, false));
               }
            }
         }
      }
   }
1203709
def __validate_datetime_string(self):
        

        try:
            try:
                StrictVersion(self._value)
                raise TypeConversionError(
                    "invalid datetime string: version string found {}".format(self._value)
                )
            except ValueError:
                pass
        except TypeError:
            raise TypeConversionError("invalid datetime string: type={}".format(type(self._value)))
742540
protected final boolean isDurationValid() {

        if (isValidEndTypeForPattern()) {
            switch (getEndType()) {
                case DATE:
                    return (getStart().getTime() < (getSeriesEndDate().getTime() + DAY_IN_MILLIS));
                case TIMES:
                    return getOccurrences() > 0;
                case SINGLE:
                    return true;
                default:
                    return false;
            }
        } else {
            return false;
        }
    }
41089
def validate_time_range(form, field):
    

    string = field.data
    try:
        begin, end = string.split('-')
        begin = begin.strip()
        end = end.strip()
        begin_hours, begin_min = begin.split(':')
        end_hours, end_min = end.split(':')
        assert 0 <= int(begin_hours) <= 23
        assert 0 <= int(end_hours) <= 23
        assert 0 <= int(begin_min) <= 59
        assert 0 <= int(end_min) <= 59
        assert begin_hours <= end_hours
        if begin_hours == end_hours:
            assert begin_min < end_min
    except (ValueError, AssertionError):
        raise ValidationError('Make sure the time is in correct format: "hh:mm - hh:mm"')
248753
protected function _isValidDate()
    {
        $oSeries = $this->getSerie();
        $iTime = time();

        // If date is not set will add day before and day after to check if voucher valid today.
        $iTomorrow = mktime(0, 0, 0, date("m"), date("d") + 1, date("Y"));
        $iYesterday = mktime(0, 0, 0, date("m"), date("d") - 1, date("Y"));

        // Checks if beginning date is set, if not set $iFrom to yesterday so it will be valid.
        $iFrom = ((int) $oSeries->oxvoucherseries__oxbegindate->value) ?
            strtotime($oSeries->oxvoucherseries__oxbegindate->value) : $iYesterday;

        // Checks if end date is set, if no set $iTo to tomorrow so it will be valid.
        $iTo = ((int) $oSeries->oxvoucherseries__oxenddate->value) ?
            strtotime($oSeries->oxvoucherseries__oxenddate->value) : $iTomorrow;

        if ($iFrom < $iTime && $iTo > $iTime) {
            return true;
        }

        $oEx = oxNew(\OxidEsales\Eshop\Core\Exception\VoucherException::class);
        $oEx->setMessage('MESSAGE_COUPON_EXPIRED');
        if ($iFrom > $iTime && $iTo > $iTime) {
            $oEx->setMessage('ERROR_MESSAGE_VOUCHER_NOVOUCHER');
        }
        $oEx->setVoucherNr($this->oxvouchers__oxvouchernr->value);
        throw $oEx;
    }
507907
public void validate() {
    if (start == null || start.isEmpty()) {
      throw new IllegalArgumentException("missing or empty start");
    }
    DateTime.parseDateTimeString(start, timezone);
    
    if (end != null && !end.isEmpty()) {
      DateTime.parseDateTimeString(end, timezone);
    }
    
    if (downsampler != null) {
      downsampler.validate();
    }
    
    if (aggregator == null || aggregator.isEmpty()) {
      throw new IllegalArgumentException("Missing or empty aggregator");
    }
    
    try {
      Aggregators.get(aggregator.toLowerCase());
    } catch (final NoSuchElementException e) {
      throw new IllegalArgumentException("Invalid aggregator");
    }
  }
643024
def _check_time_range(time_range, now):
    '''
    
    '''
    if _TIME_SUPPORTED:
        _start = dateutil_parser.parse(time_range['start'])
        _end = dateutil_parser.parse(time_range['end'])

        return bool(_start <= now <= _end)
    else:
        log.error('Dateutil is required.')
        return False
896786
def validate_wrap(self, value):
        ''' '''
        if not isinstance(value, datetime):
            self._fail_validation_type(value, datetime)

        if self.use_tz and value.tzinfo is None:
            self._fail_validation(value, '''datetime is not timezone aware and use_tz is on.  make sure timezone is set on the session''')

        # if using timezone support it isn't clear how min and max should work,
        # so the problem is being punted on for now.
        if self.use_tz:
            return

        # min/max
        if self.min is not None and value < self.min:
            self._fail_validation(value, 'DateTime too old')
        if self.max is not None and value > self.max:
            self._fail_validation(value, 'DateTime too new')
881272
def validation_accepts_or_updates_time?(validations_for_type)
      res = validations_for_type.each_with_object([]) do |validation, offsets|
        r = validation.validate(@time, @start_time)
        return true if r.nil? || r == 0
        offsets << r
      end
      shift_time_by_validation(res, validations_for_type.first)
      false
    end
427185
def timestamping_validate(data, schema):
    
    jsonschema.validate(data, schema)
    data['timestamp'] = str(time.time())
1226468
def validate(self, value, redis):
        '''
        
        '''

        value = self.value_or_default(value)

        self.validate_required(value)

        if value is None:
            return None

        if type(value) == str:
            try:
                value = datetime.datetime.strptime(value, '%Y-%m-%dT%H:%M:%SZ')
            except ValueError:
                raise InvalidFieldError(self.name)

        return value
58841
def validate_hour_lock(time, start_time)
      h0 = starting_unit(start_time)
      h1 = time.hour
      if h0 >= h1
        h0 - h1
      else
        if dst_offset = TimeUtil.dst_change(time)
          h0 - h1 + dst_offset
        else
          24 - h1 + h0
        end
      end
    end
40068
function validateDateTimeHTTPInput( $day, $month, $year, $hour, $minute, $second, $contentObjectAttribute )
    {
        $state = eZDateTimeValidator::validateDate( $day, $month, $year );
        if ( $state == eZInputValidator::STATE_INVALID )
        {
            $contentObjectAttribute->setValidationError( ezpI18n::tr( 'kernel/classes/datatypes',
                                                                 'Date is not valid.' ) );
            return eZInputValidator::STATE_INVALID;
        }

        $state = eZDateTimeValidator::validateTime( $hour, $minute, $second );

        if ( $state == eZInputValidator::STATE_INVALID )
        {
            $contentObjectAttribute->setValidationError( ezpI18n::tr( 'kernel/classes/datatypes',
                                                                 'Time is not valid.' ) );
            return eZInputValidator::STATE_INVALID;
        }
        return $state;
    }