Checks if a given date is in a given range of dates.

@param string|\DateTime $value
@param bool             $inclusive
@param string $minDate
@param string $maxDate

@return bool
761871
public static function isBetween($value, $minDate, $maxDate, $inclusive = false)
    {
        if (false === $inclusive) {
            return (self::isAfter($value, $minDate, false) && self::isBefore($value, $maxDate, false));
        }

        return (self::isAfter($value, $minDate, true) && self::isBefore($value, $maxDate, true));
    }
138538
public boolean isInRange(@Nullable CalendarDay minDate, @Nullable CalendarDay maxDate) {
    return !(minDate != null && minDate.isAfter(this)) &&
        !(maxDate != null && maxDate.isBefore(this));
  }
908206
public function checkDate($value, ExecutionContextInterface $context)
    {
        $format = self::PHP_DATE_FORMAT;

        if (! empty($value) && false === \DateTime::createFromFormat($format, $value)) {
            $context->addViolation(Translator::getInstance()->trans("Date '%date' is invalid, please enter a valid date using %fmt format", [
                        '%fmt' => self::MOMENT_JS_DATE_FORMAT,
                        '%date' => $value
                    ]));
        }
    }
881925
public function isValid($value = null, $context = null)
    {
        $isValid = parent::isValid($value);
        $date    = $this->convertToDateTime($value);

        if (!$isValid || !$date) {
            return false;
        }

        $now = new DateTime();

        $now->setTime(23, 59, 59);
        $date->setTime(0, 0, 0);

        if ($date > $now || $date->diff($now)->y < $this->minimum) {
            $this->error(self::NOT_GREATER);

            return false;
        }

        return true;
    }
1274141
protected function normalizeDateTime($value)
    {
        try {
            if (is_int($value)) {
                //timestamp
                $value = new DateTime("@$value");
            } elseif (!$value instanceof DateTime) {
                $value = new DateTime($value);
            }
        } catch (\Exception $e) {
            throw new InvalidArgumentException('Invalid date string provided', $e->getCode(), $e);
        }

        return $value;
    }
1034898
public function isSatisfied($dateValue, $value)
    {
        if ($this->isIncrementsOfRanges($value)) {
            return $this->isInIncrementsOfRanges($dateValue, $value);
        } elseif ($this->isRange($value)) {
            return $this->isInRange($dateValue, $value);
        }

        return $value == '*' || $dateValue == $value;
    }
86279
private boolean isTooOld(Date cacheDate) {
        Date now = new Date();
        return now.getTime() - cacheDate.getTime() > MAX_CACHE_TIME_MILLIS;
    }
1297774
public static function isValid($value)
    {
        if ($value instanceof \DateTime)
            return true;
        try {
            new static($value);
            return !is_null($value);
        } catch (\Exception $e) {
            return false;
        }
    }
647185
protected function checkDateTime($value, $base = null)
    {
        if (is_null($value)) {
            return $value;
        }

        if (!$value instanceof \DateTimeInterface) {
            return $this->buildDateTimebyString($value, $base);
        } else {
            return $value;
        }
    }
1264497
public function setEndDate($date, $inclusive = null)
    {
        if (!is_null($date) && !$date = call_user_func([$this->dateClass, 'make'], $date)) {
            throw new InvalidArgumentException('Invalid end date.');
        }

        if (!$date) {
            return $this->removeFilter(static::END_DATE_FILTER);
        }

        $this->endDate = $date;

        if ($inclusive !== null) {
            $this->toggleOptions(static::EXCLUDE_END_DATE, !$inclusive);
        }

        if (!$this->hasFilter(static::END_DATE_FILTER)) {
            return $this->addFilter(static::END_DATE_FILTER);
        }

        $this->handleChangedParameters();

        return $this;
    }
154329
public static function isDate($value) {
        if (!trim($value)) {
            return false;
        }

        if (trim($value) == '0000-00-00') {
            return false;
        }

        if (trim($value) == '0000-00-00 00:00:00') {
            return false;
        }

        return true;
    }
370222
public function datetime($value): bool
    {
        if (!is_scalar($value)) {
            return false;
        }

        if (is_numeric($value)) {
            return true;
        }

        return (int)strtotime($value) != 0;
    }
917229
public function isContains(DateTime $Date, $inclusive = true) {
		if ($inclusive) {
			return $this->_startDate <= $Date && $Date <= $this->_endDate;
		} else {
			return $this->_startDate < $Date && $Date < $this->_endDate;
		}
	}
876970
public function checkDate($value)
    {

        if ($value instanceof PointInTimeContract) {
            return $value->isValid();
        }

        if ($value instanceof DateTimeInterface) {
            return true;
        }

        // Support for legacy datetime objects like Zend_Date
        if (is_object($value) && method_exists($value, 'getTimestamp')) {
            return $this->checkInt($value->getTimestamp());
        }

        if ((!Type::isStringLike($value) && !is_numeric($value)) || strtotime($value) === false) {
            return false;
        }

        $date = date_parse($value);

        return checkdate($date['month'], $date['day'], $date['year']);
    }
468889
static public function isToday($value)
    {
        $time = DataHelper::toUnixtime($value);
        $todayRange = static::todayRange();
        
        if ($time >= $todayRange[0] && $time <= $todayRange[1]) {
            return true;
        }
        return false;
    }
528229
public static function isLte($value, $min)
    {
        is_array($min) && $min = $min[0];
        if (!is_numeric($value)) {
            return false;
        } else {
            return $value <= $min;
        }
    }
149127
public static function date($min = null, $max = null, $formatReturn = null) {
		if ($min === null && $max === null) {
			$res = time();
		} elseif ($min > 0 && $max === null) {
			$res = $min;
		} elseif ($min > 0 && $max > 0) {
			$res = static::int($min, $max);
		} else {
			$res = time();
		}

		$res = 0;
		$formatReturnAs = FORMAT_DB_DATETIME;
		if ($formatReturn !== null) {
			if ($formatReturn === false) {
				return $res;
			}
			$formatReturnAs = $formatReturn;
		}
		return date($formatReturnAs);
	}