protected function isValid($dateTime)
    {
        if (!$dateTime instanceof \DateTimeInterface) {
            $this->addError('The given value was not a valid date', 1324314378);
            return;
        }
        $earliestDate = isset($this->options['earliestDate']) ? $this->parseReferenceDate($this->options['earliestDate']) : null;
        $latestDate = isset($this->options['latestDate']) ? $this->parseReferenceDate($this->options['latestDate']) : null;

        if (isset($earliestDate) && isset($latestDate)) {
            if ($dateTime < $earliestDate || $dateTime > $latestDate) {
                $this->addError('The given date must be between %s and %s', 1325615630, [$earliestDate->format('Y-m-d H:i:s'), $latestDate->format('Y-m-d H:i:s')]);
            }
        } elseif (isset($earliestDate)) {
            if ($dateTime < $earliestDate) {
                $this->addError('The given date must be after %s', 1324315107, [$earliestDate->format('Y-m-d H:i:s')]);
            }
        } elseif (isset($latestDate)) {
            if ($dateTime > $latestDate) {
                $this->addError('The given date must be before %s', 1324315115, [$latestDate->format('Y-m-d H:i:s')]);
            }
        }
    }