FG
๐Ÿ’ป Software๐Ÿ—„๏ธ Databases

[BUG]: timestamp mode 'date' returns value.toISOString is not a function for parameterized inserts

Fresh3 months ago
Mar 14, 20260 views
Confidence Score87%
87%

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

Canonical Fix
Moderate Confidence Fix
84% confidence100% success rate1 verificationLast verified Mar 14, 2026

Solution: [BUG]: timestamp mode 'date' returns value.toISOString is not a function for parameterized inserts

Low Risk

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.

84

Trust Score

1 verification

100% success
  1. 1

    This is likely related to the issue I created.

    This is likely related to the issue I created.

  2. 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

Worked: 1
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

drizzleormtypescriptenhancementdb/postgrespriorityqb/crud