Apollo iOS Swift DateTime Not Supported

Hello Team,
We are getting below issue when fetching datetime in graphQL Swift.

Failure! Error: GraphQLResultError(path: delivery.nodes.0.tripDate, underlying: Apollo.JSONDecodingError.couldNotConvert(value: 2023-01-23T17:05:09.000Z, to: Foundation.Date))

below is the response that we are getting from server.
TripDate here is a datetime field in graphQL

but apollo swift not able to read the datetime property.

we have use passThroughCustomScalar in apollo api inbuilt phases as shown below but we are not able to get the data

Go to the build root and search up the chain to find the Derived Data Path where the source packages are checked out.

DERIVED_DATA_CANDIDATE=“${BUILD_ROOT}”

while ! [ -d “${DERIVED_DATA_CANDIDATE}/SourcePackages” ]; do

if [ “${DERIVED_DATA_CANDIDATE}” = / ]; then

echo >&2 “error: Unable to locate SourcePackages directory from BUILD_ROOT: ‘${BUILD_ROOT}’”

exit 1

fi

DERIVED_DATA_CANDIDATE=“$(dirname “${DERIVED_DATA_CANDIDATE}”)”

done

Grab a reference to the directory where scripts are checked out

SCRIPT_PATH=“${DERIVED_DATA_CANDIDATE}/SourcePackages/checkouts/apollo-ios/scripts”

if [ -z “${SCRIPT_PATH}” ]; then

echo >&2 “error: Couldn’t find the CLI script in your checked out SPM packages; make sure to add the framework to your project.”

exit 1

fi

cd “${SRCROOT}/${TARGET_NAME}”

“${SCRIPT_PATH}”/run-bundled-codegen.sh codegen:generate --target=swift --includes=./**/*.graphql --passthroughCustomScalars --localSchemaFile=“schema.json” API.swift

Apollo Version :0.53.0
sqlLite.Sqift : 0.13.3

It sounds like you are perhaps not setting up your custom scalar JSON decoding. When using custom scalars, you need to manually implement decoding methods for the types you use for those scalars. If you are using Foundation.Date, you need to make that type conform to JSONDecodable.

Please see the notes on this in our documentation.

This documentation is for the legacy version you are using. 1.0 takes a different approach to custom scalars and the codegen engine doesn’t support the passthroughCustomScalars anymore.

We also have a Swift Playground that demonstrates a custom scalar parsing an ISO date string.