Next.js Discord

Discord Forum

Vercel Postgres column datatype Timestamp is storing Date valueswith a 3 day offset

Unanswered
Greenish Elaenia posted this in #help-forum
Open in Discord
Greenish ElaeniaOP
When submitting a fetch POST to an api route with {
dob: '1993-01-01'
}

const { dobInput } = await request.json();
const dobDate = new Date(dobInput);

// Update table
let updateResult =
await sqlUPDATE users SET dob = ${dobInput} WHERE username = ${usernameHidden};


It is storing into the database;
Wed Jan 06 1993 00:00:00 GMT+0800 (Taipei Standard Time)

This is wrong. It should be storing:
Fri Jan 01 1993 00:00:00 GMT+0800 (Taipei Standard Time)

How do I fix this?

1 Reply

It might be a issue with timezone conversion. Postgres stores date in UTC.