src/Schema/Types/Scalars/DateTime.php
public function serialize($value): string
    {
        if ($value instanceof Carbon) {
            return $value->toDateTimeString();
        }

        return $this
            ->tryParsingDateTime($value, InvariantViolation::class)
            ->toDateTimeString();
    }
public function serialize($value): string
    {
        if ($value instanceof Carbon) {
            return $value->toDateTimeString();
        }

        return $this
            ->tryParsingDateTime($value, InvariantViolation::class)
            ->toDateTimeString();
    }
public function serialize ( $ value ) : string { if ( $ value instanceof Carbon ) { return $ value -> toDateTimeString ( ) ; } return $ this -> tryParsingDateTime ( $ value , InvariantViolation :: class ) -> toDateTimeString ( ) ; }
Serialize an internal value, ensuring it is a valid datetime string.

@param  \Carbon\Carbon|string  $value
@return string
Serialize an internal value ensuring it is a valid datetime string .