public function normalizeDate($date)
    {
        if ($date instanceof \DateTime) {
            return $date;
        }

        $date = preg_replace('/\.[0-9]+/', '', $date);
        return \DateTime::createFromFormat(\DateTime::ISO8601, $date);
    }
public function normalizeDate($date)
    {
        if ($date instanceof \DateTime) {
            return $date;
        }

        $date = preg_replace('/\.[0-9]+/', '', $date);
        return \DateTime::createFromFormat(\DateTime::ISO8601, $date);
    }
public function normalizeDate ( $ date ) { if ( $ date instanceof \ DateTime ) { return $ date ; } $ date = preg_replace ( '/\.[0-9]+/' , '' , $ date ) ; return \ DateTime :: createFromFormat ( \ DateTime :: ISO8601 , $ date ) ; }
Normalize date from ISO8601, if is string it returns a DateTime object

@param {DateTime|string|bool} $date

@return {DateTime|bool} Return DateTime or false for Invalid Dates
Normalize date from ISO8601 if is string it returns a DateTime object