[BUG]: timestamp mode 'date' returns value.toISOString is not a function for parameterized inserts
Problem
What version of `drizzle-orm` are you using? 0.28.5 What version of `drizzle-kit` are you using? 0.19.13 Describe the Bug Trying to do a sql.placeholder of a timestamp mode 'date' returns `value.toISOString is not a function` at compile time. When I first load my page presumably it is doing the prepared statement and throwing error. Mode 'string' seems to work. [code block] Exception [code block] Note that this seems to work around it at parameterization: [code block] or in schema switch to string mode: [code block] Expected behavior I would expect placeholders of timestamp to not try to do toISOString. Environment & setup Windows. Postgres 15.
Error Output
error Error [TypeError]: value.toISOString is not a function
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: [BUG]: timestamp mode 'date' returns value.toISOString is not a function for parameterized inserts
This is likely related to the issue I created. When we set mode to string, TypeScript shows the return type as string, however a date object is returned. I suspect the inverse might happen with string mode.
Trust Score
1 verification
- 1
This is likely related to the issue I created.
This is likely related to the issue I created.
- 2
When we set mode to string, TypeScript shows the return type as string, however
When we set mode to string, TypeScript shows the return type as string, however a date object is returned. I suspect the inverse might happen with string mode.
Validation
Resolved in drizzle-team/drizzle-orm GitHub issue #1113. Community reactions: 0 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep