select date '2020-01-01 10:20:30'
のようなリテラルの場合は date を前に書くだけで date 型にキャストされますが ここを $1 にすることはできないです
date($1) や $1::date でキャストする必要があります
実際の値で SQL を書いてから変数化するとハマりやすいんですよね
/// c は pg.Client
> c.query("select date '2020-01-01 10:20:30'").then(x => console.log(x.rows)).catch(console.error)
// [ { date: 2019-12-31T15:00:00.000Z } ]
> c.query("select date $1", [new Date()]).then(x => console.log(x.rows)).catch(console.error)
// error: syntax error at or near "$1"
> c.query("select date($1)", [new Date()]).then(x => console.log(x.rows)).catch(console.error)
// [ { date: 2020-01-05T15:00:00.000Z } ]
> c.query("select $1::date", [new Date()]).then(x => console.log(x.rows)).catch(console.error)
// [ { date: 2020-01-05T15:00:00.000Z } ]