public function setMax($max)
    {
        if ($max instanceof DateTime) {
            $this->max = $max;
        } else {
            try {
                $this->max = new DateTime($max);
            } catch (\Exception $e) {
                $this->max = null;
            }
        }

        return $this;
    }