I am using the npm library pg to print the current date, however it gives the date of yesterday with the time set to 21:00:00.000Z.
const { Client } = require('pg')
const client = new Client();
(async function fn() {
await client.connect();
const res = await client.query("SELECT current_date");
const rows = res.rows;
/** @type { Date } */
const dt = rows[0]['current_date'];
console.log(dt); // 2022-06-04T21:00:00.000Z
await client.end();
})();
When I issue the command from psql I get the correct current date ("2022-06-05").
SELECT current_date;
My timezone is UTC+03 so I am guessing it has to do with why I am getting this kind of date, but beyond that I dont know.
Kindly help explain.