I am using node and postgresql (and node-postgres).
I am trying to execute an insert statement, but I get the following error:
error: malformed array literal: "2020-01-15T20:09:22.711+02:00"
My code is as follows:
const queryInsert = {
text: 'INSERT INTO my_table(some_date, last_update) VALUES($1, $2)',
values: [2020-01-15T20:09:22.711+02:00, new Date()]
}
client.query(
queryInsert.text,
queryInsert.values,
(err, res)=> {
done();
if (err) {
console.log('Query: '+queryInsert.text, err);
}
console.log(res);
}
);
Question
Do I need to somehow format the values if they are dates? If so, how? If not, any advise welcome.
Thank you