Kysley with Postgres - why aren't timestamp fields deserialized as Date in JS?

297 Views Asked by At

I have Kysley setup with Postgresql. When I write something like this:

    const temp = await this.qb.selectFrom('app_user').select(['id', 'ts_modified']).execute();
    console.log(temp[0]);

outputs: { id: 1142, tsModified: '2022-03-02 10:55:52.31056+01' }

Typscript recognizes that temp[0] is of type {id: int, ts_modified: Date} because I have that interface properly configured, but at runtime Kysley (or pg beneath it) does not deserialize ts_modified to Date (as defined in the interface), but as string.

Why is that? Where do I change it?

I'm using:

    "kysely": "^0.26.3",
    "pg": "^8.11.3",
0

There are 0 best solutions below