title: Customizing Date Serialization in Axios
body: <p>By default, when a JavaScript object contains a Date object, Axios serializes it into UTC. This means that the time transmitted is converted using the time zone. This doesn't work for my use case. I need to send the time without the time zone conversion to UTC.</p>
  <p>I implemented a custom serializer based on <a href="https://github.com/axios/axios/issues/1548" rel="nofollow noreferrer">#1548</a>, but it has no effect. I have verified that the config is being modified, but when I look at the request payload, the dates are still using UTC (2022-02-03T04:59:00.000Z).</p>
  <p>Note: My logic is more complicated, I am using toLocalString() in the code below to simplify the example.</p>
  <pre><code>const a = axios.create()
  a.interceptors.request.use((config) =&gt; {
    config.paramsSerializer = (params) =&gt;
      qs.stringify(params, {
        serializeDate: (date: Date) =&gt; date.toLocaleString(),
      })
    return config
  })
  </code></pre>
  <p>Anyone understand why I can't override the default behavior and use my own date formatting?</p>
  <p>Environment
  Axios Version 0.21.1</p>