# Is it possible to map scalars (Date) client-side?

**URL:** <https://community.apollographql.com/t/is-it-possible-to-map-scalars-date-client-side/1462>\
**Category:** Client SDKs\
**Tags:** client, web\
**Created:** [September 23, 2021, 11:03am UTC](https://community.apollographql.com/t/is-it-possible-to-map-scalars-date-client-side/1462 "2021-09-23T11:03:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vectorian](https://avatars.discourse-cdn.com/v4/letter/v/a183cd/32.png) [@vectorian](https://community.apollographql.com/u/vectorian)\
**Post date:** [September 23, 2021, 11:03am UTC](https://community.apollographql.com/t/is-it-possible-to-map-scalars-date-client-side/1462/1 "2021-09-23T11:03:34Z")

</div>

I would like to automatically translate values queried with the scalar type `Date` to JavaScript `Date` objects client-side.

There are many examples on how to do this mapping server-side, but can the equivalent be done server-side by passing something to `new ApolloClient`?

Like:

```auto
new ApolloClient({
  scalars: {
    Date: {
      parseLiteral: value => new Date(value),
      serialize: value => value.toISOString()
    }
  }
})

```

---

<div class="post-metadata">

**Author:** ![brainkim](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/brainkim/32/22_2.png) [@brainkim](https://community.apollographql.com/u/brainkim)\
**Post date:** [September 23, 2021, 6:21pm UTC](https://community.apollographql.com/t/is-it-possible-to-map-scalars-date-client-side/1462/2 "2021-09-23T18:21:00Z")

</div>

So currently, there is no functionality to do that. I personally would love for something like this to exist. The proposed solution right now is to use cache read functions to deserialize scalars on a per field basis ([Customizing the behavior of cached fields - Apollo GraphQL Docs](https://www.apollographql.com/docs/react/caching/cache-field-behavior/#the-read-function)).

The feature request for custom scalars should also have more information! [Support for custom scalars · Issue #8857 · apollographql/apollo-client · GitHub](https://github.com/apollographql/apollo-feature-requests/issues/2)
