juanluispaz / ts-sql-query

Type-safe SQL query builder like QueryDSL or JOOQ in Java or Linq in .Net for TypeScript with MariaDB, MySql, Oracle, PostgreSql, Sqlite and SqlServer support.
https://ts-sql-query.readthedocs.io/
MIT License
291 stars 19 forks source link

Invalid localDate value to send to the db #105

Closed guzmanf closed 1 year ago

guzmanf commented 1 year ago

hello friends

in postgresql, how to resolve "Invalid localDate value to send to the db: 2023-5-20" ...help, advice

regards

juanluispaz commented 1 year ago

Hi,

Please, ~always include the database name you are using (PostgreSQL, Oracle, etc.)~ (Edit: I see you later added the database name, I read your message in the email notification) and, if possible, a small example.

It sounds like you are bypassing the typescript type validations; localDate expects a Date object, but you are providing the string "2023-5-20". In this case, the type indicated by TypeScript and the type received in JavaScript is not matching.

If you want to use date as string, you should use a "customComparable" field in the table definition.

Let me know if this helps you.

guzmanf commented 1 year ago

Juan.... muchas gracias efectivamente era el tipo de dato que no estaba validando, error de principiante. salu2