You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Temporal is the modern replacement for Date and is now shipping in runtimes (Node 26, etc.). Passing a Temporal value to escape() today falls through to the generic object handling and produces broken SQL:
escape(Temporal.Instant.from('2012-05-07T11:42:03.002Z'));// currently => garbage / object expansion, not a valid literal
Date is already special-cased; Temporal deserves the same treatment.
Proposed API
Mirror the existing Date behavior, mapping each Temporal type to its natural MySQL literal:
Temporal type
Treated as
Output
Instant, ZonedDateTime
absolute time
dateToString, honoring the timezone arg exactly like Date (ms precision)
PlainDateTime
wall-clock
DATETIME literal, timezone ignored
PlainDate
wall-clock
DATE literal
PlainTime
wall-clock
TIME literal
others (Duration, PlainYearMonth, ...)
—
ISO-string fallback
Detection via Object.prototype.toString (Symbol.toStringTag, i.e. [object Temporal.*]), so the Temporal global is never referenced and runtimes without Temporal are unaffected.
Open questions for maintainers
Precision — Instant via epochMilliseconds gives millisecond precision (identical to Date). Should sub-ms (µs/ns) be preserved for DATETIME(6), or is matching Date preferred?
Activity