if ($DateTo instanceof DateTime) {
            $query->where("date", "<=", $DateTo->format(DateTime::ISO8601));
        }