Vendor/phpspreadsheet/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTime.php
public static function getDateValue($dateValue)
    {
        if (!is_numeric($dateValue)) {
            if ((is_string($dateValue)) &&
                (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC)) {
                return Functions::VALUE();
            }
            if ((is_object($dateValue)) && ($dateValue instanceof \DateTime)) {
                $dateValue = Date::PHPToExcel($dateValue);
            } else {
                $saveReturnDateType = Functions::getReturnDateType();
                Functions::setReturnDateType(Functions::RETURNDATE_EXCEL);
                $dateValue = self::DATEVALUE($dateValue);
                Functions::setReturnDateType($saveReturnDateType);
            }
        }

        return $dateValue;
    }
public static function getDateValue($dateValue)
    {
        if (!is_numeric($dateValue)) {
            if ((is_string($dateValue)) &&
                (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC)) {
                return Functions::VALUE();
            }
            if ((is_object($dateValue)) && ($dateValue instanceof \DateTime)) {
                $dateValue = Date::PHPToExcel($dateValue);
            } else {
                $saveReturnDateType = Functions::getReturnDateType();
                Functions::setReturnDateType(Functions::RETURNDATE_EXCEL);
                $dateValue = self::DATEVALUE($dateValue);
                Functions::setReturnDateType($saveReturnDateType);
            }
        }

        return $dateValue;
    }
getDateValue.

@param string $dateValue

@return mixed Excel date/time serial value, or string if error