File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -229,8 +229,12 @@ function decodeColumnValue<V = any>(args: {
229229 }
230230
231231 if ( columnTypeName === "datetime" ) {
232+ // SQLite stores datetimes as strings but may return them in different formats
233+ // depending on how they were inserted. Support both ISO strings (from
234+ // Temporal.Instant.toString() or Date.toISOString()) and epoch milliseconds
235+ // (from numeric timestamps).
232236 if ( typeof value === "string" ) {
233- // Handle ISO string format
237+ // Handle ISO string format (e.g., "2024-01-01T00:00:00Z")
234238 return Temporal . Instant . from ( value ) as V ;
235239 }
236240 if ( typeof value === "number" ) {
@@ -247,12 +251,14 @@ function decodeColumnValue<V = any>(args: {
247251}
248252
249253function encodeColumnValue ( value : any ) : any {
254+ // Encode Temporal types to ISO string format for SQLite storage
250255 if ( value instanceof Temporal . Instant ) {
251256 return value . toString ( ) ;
252257 }
253258 if ( value instanceof Temporal . Duration ) {
254259 return value . toString ( ) ;
255260 }
261+ // Legacy support for Date objects
256262 if ( value instanceof Date ) {
257263 return value . toISOString ( ) ;
258264 }
You can’t perform that action at this time.
0 commit comments