The exporter is not able to write DateTime objects into csv. This method converts them to string.

@param mixed $row

@return array
493685
public function prepareData($row)
    {
        if (!$row) {
            return $row;
        }

        if (!is_array($row)) {
            $row = $this->serializer->serialize($row, 'array', SerializationContext::create()->setSerializeNull(true));
        }

        foreach ($row as $key => $value) {
            if ($value instanceof \DateTime) {
                $row[$key] = $value->format(\DateTime::RFC3339);
            } elseif (is_bool($value)) {
                $row[$key] = true === $value ? 1 : 0;
            } elseif (is_array($value) || is_object($value)) {
                $row[$key] = json_encode($value);
            }
        }

        return $row;
    }
1296628
public function updateRows(array $rows): array
    {
        $list = [];
        foreach ($rows as $key => $row) {
            $key = (string)$key;
            if (!$this->hasKey($key)) {
                $list[$key] = null;
            } else {
                $path = $this->getPathFromKey($key);
                $file = $this->getFile($path);
                $list[$key] = $this->saveFile($file, $row);
            }
        }

        return $list;
    }
141787
public function validateRow($row)
    {
        try {
            $this->castRow($row);

            return [];
        } catch (Exceptions\FieldValidationException $e) {
            return $e->validationErrors;
        }
    }
1274361
public function createDataObject($row)
    {
        $class = $this->dataClass;

        if (empty($row['ClassName'])) {
            $row['ClassName'] = $class;
        }

        // Failover from RecordClassName to ClassName
        if (empty($row['RecordClassName'])) {
            $row['RecordClassName'] = $row['ClassName'];
        }

        // Instantiate the class mentioned in RecordClassName only if it exists, otherwise default to $this->dataClass
        if (class_exists($row['RecordClassName'])) {
            $class = $row['RecordClassName'];
        }

        $item = Injector::inst()->create($class, $row, false, $this->getQueryParams());

        return $item;
    }
1068026
protected function put(array $row)
    {
        if (defined('HHVM_VERSION') === true) {
            $result = fputcsv(
                $this->csv,
                $row,
                $this->getConfig('delimiter'),
                $this->getConfig('quote')
            );
        } else {
            $result = fputcsv(
                $this->csv,
                $row,
                $this->getConfig('delimiter'),
                $this->getConfig('quote'),
                $this->getConfig('escape')
            );
        }
        // It's not trivial to measure how many bytes we should have written,
        // so we'll just ensure we have at least one per element.
        if ($result === false || $result < count($row)) {
            throw new \RuntimeException('Unable to write to output file.');
        }
        return $result;
    }
948678
protected function generateBox($row)
    {
        return [
            'name' => $this->boxName(),
            'value' => $row->getKey(),
            'checked' => ($children = $this->children())
                && $children->contains($row->getKey()),

            // Former is giving these a class of "form-control" which isn't correct
            'class' => false,

            // Add the model instance so the decorator can use it
            'model' => $row,
        ];
    }
1221299
private function translateRow(&$row)
    {
        $new_row = [];

        // Translate incoming data via mapping array.
        foreach ($row as $key => $value) {
            if (array_has($this->config['mapping'], $key)) {
                $new_row[array_get($this->config['mapping'], $key)] = $value;
            }
        }

        // Replace with translated row.
        $row = $new_row;
    }
1363524
public static function dump(
        iterable $row,
        string $delimiter = ',',
        string $enclosure = '"',
        string $escape = '\\'
    ): string {
        $row = Arr::from($row);

        $res = fopen('php://temp', 'r+');

        try {
            $written = Thrower::call('fputcsv', $res, $row, $delimiter, $enclosure, $escape);
            $out = stream_get_contents($res, -1, 0);
        } catch (\Throwable $e) {
            throw new \RuntimeException('Failed to write CSV row.', 0, $e);
        } finally {
            fclose($res);
            unset($res);
        }

        if ($written === 0 || $written === false) {
            throw new \RuntimeException('Failed to write CSV row.');
        }

        return $out;
    }
181022
public static function mapArraybleRow($row): array
    {
        // When dealing with eloquent models, we'll skip the relations
        // as we won't be able to display them anyway.
        if (method_exists($row, 'attributesToArray')) {
            return $row->attributesToArray();
        }

        if ($row instanceof Arrayable) {
            return $row->toArray();
        }

        // Convert StdObjects to arrays
        if (is_object($row)) {
            return json_decode(json_encode($row), true);
        }

        return $row;
    }
476895
public function writeRow($row)
    {
        if (is_string($row)) {
            $row = explode(',', $row);
            $row = array_map('trim', $row);
        }

        return $this->getHandle()->fputcsv($row, $this->delimiter, $this->enclosure);
    }
420621
public function decode(string $row): array
    {
        $stream = fopen('php://memory', 'r+');
        fputs($stream, $row);
        rewind($stream);
        $result = [];
        $names = fgetcsv($stream, 0, "\t");
        if (empty($names) === true) {
            throw new \RuntimeException('failed decoding names from response');
        }
        while(($row = fgetcsv($stream, 0, "\t")) !== false) {
            $result[] = array_combine($names, $row);
        }
        fclose($stream);
        return $result;
    }
152590
public function getColumnValue(Row $row)
	{
		$value = parent::getColumnValue($row);

		if (!is_numeric($value)) {
			return $value;
		}

		return number_format(
			(float) $value,
			(int) $this->number_format[0],
			(string) $this->number_format[1],
			(string) $this->number_format[2]
		);
	}
1321053
protected function _formatRow(array $row) {
        $out = '';
        foreach ($row as $key => $value) {
            if (is_array($value)) {
                // This is the case with hasMany and hasAndBelongsToMany related
                // rowsets.
                $value = $this->_formatRelatedRowset($value);
            }
            $out .= "$key: $value\n";
        }
        return $out;
    }
218161
protected function getArray($row)
    {
        if (!$row instanceof Traversable && !is_array($row)) {
            throw new InvalidArgumentException("The input is not an array or traversable");
        }
        return ($row instanceof Traversable) ? iterator_to_array($row, true) : $row;
    }
635684
private function _getWhere($row)
    {
        $where = array();
        foreach ($this->_groupBy as $k=>$field) {
            if (is_array($field)) {
                $values = $field;
                $field = $k;
                $valueFound = false;
                foreach ($values as $value) {
                    if ($row->$field == $value) {
                        $valueFound = true;
                        if (is_null($value)) {
                            $where[] = "ISNULL($field)";
                        } else {
                            $where["$field = ?"] = $value;
                        }
                        break;
                    }
                }
                if (!$valueFound) {
                    $in = array();
                    foreach ($values as $value) {
                        $in[] = $row->getTable()->getAdapter()->quote($value);
                    }
                    $in = implode(',', $in);
                    $where[] = "$field NOT IN ($in)";
                }
            } else {
                if (is_null($row->$field)) {
                    $where[] = "ISNULL($field)";
                } else {
                    $where["$field = ?"] = $row->$field;
                }
            }
        }
        return $where;
    }
583713
protected function getAttributesString(array $row)
    {
        $attributes = [];
        foreach ($this->getAttributes() as $attrKey => $attrValue) {
            if ('href' === $attrKey) {
                $attrValue = $this->getLinkReplaced($row);
            }
            $attributes[] = $attrKey.'="'.$attrValue.'"';
        }

        return implode(' ', $attributes);
    }
1340621
public function lastModified($row, $column):?\DateTime
    {
        $file = $this->getData($row, $column);

        if ($file == null) {
            return null;
        }

        $file = rtrim($file, DIRECTORY_SEPARATOR);
        $file = $this->rootPath . DIRECTORY_SEPARATOR . $file;

        $format = "YmdHis";

        $dateTime = \DateTime::createFromFormat($format, date($format, filemtime($file)));

        return $dateTime;
    }