protected function convertToSqlDate($date, $isMax = false)
    {
        if (! $date instanceof \DateTime) {
            return;
        }
        
        $copy = clone $date;

        if ($isMax) {
            $copy->modify('+1 day -1 second');
        }

        return $this->expr()->literal($copy->format(self::SQL_DATE_TIME));
    }