Description
When creating a treaty client with parseDate: false, HTTP responses correctly leave ISO date strings as strings. However, WebSocket messages still auto-convert ISO date strings to Date objects — the parseDate option is not forwarded to the WS message parser.
Reproduction
import { Elysia } from "elysia";
import { treaty } from "@elysiajs/eden";
const app = new Elysia()
.get("/api/time", () => {
return { time: "2026-04-09T12:00:00.000Z" };
})
.ws("/ws", {
open(ws) {
ws.send({ time: "2026-04-09T12:00:00.000Z" });
},
message() {},
})
.listen(0);
const port = app.server!.port;
const client = treaty<typeof app>(`http://localhost:\${port}`, {
parseDate: false,
});
// HTTP: parseDate:false works
const { data } = await client.api.time.get();
console.log(typeof data!.time); // "string" ✓
// WS: parseDate:false is ignored
const ws = client.ws.subscribe();
ws.on("message", ({ data: wsData }) => {
console.log(typeof wsData.time); // "object" ✗ (Date)
console.log(wsData.time instanceof Date); // true ✗
ws.close();
app.stop();
});
Expected behavior
typeof wsData.time should be "string" when parseDate: false is set.
Actual behavior
wsData.time is a Date object — the parseDate: false config is ignored for WebSocket messages.
Root cause
Looking at the compiled source, the WS message deserializer (S function in chunk-I5KHAGLL.mjs) receives a config parameter r, and checks r?.parseDate === false. However the treaty client does not pass its config through when calling this function for WS messages.
Environment
@elysiajs/eden: 1.4.9
elysia: 1.4.27
bun: 1.3.11
Description
When creating a treaty client with
parseDate: false, HTTP responses correctly leave ISO date strings as strings. However, WebSocket messages still auto-convert ISO date strings toDateobjects — theparseDateoption is not forwarded to the WS message parser.Reproduction
Expected behavior
typeof wsData.timeshould be"string"whenparseDate: falseis set.Actual behavior
wsData.timeis aDateobject — theparseDate: falseconfig is ignored for WebSocket messages.Root cause
Looking at the compiled source, the WS message deserializer (
Sfunction inchunk-I5KHAGLL.mjs) receives a config parameterr, and checksr?.parseDate === false. However the treaty client does not pass its config through when calling this function for WS messages.Environment
@elysiajs/eden: 1.4.9elysia: 1.4.27bun: 1.3.11