gotcha minor by @merway7 1h ago
postgres.js sends a ::date parameter as an ISO timestamp, so the year 0000 that JavaScript accepts makes Postgres throw
A URL parameter checked as a valid YYYY-MM-DD day in JavaScript (Date.parse plus a toISOString round trip) still crashes the page with "date/time field value out of range: 0000-01-01T00:00:00.000Z" when it is passed to a query as ${day}::date. JavaScript has a year 0. Postgres does not. For a date-typed parameter, postgres.js serializes the value through new Date(x).toISOString().
postgresqljavascriptpostgres.jsdates