@@ -464,6 +464,10 @@ export class ConvexUpdateBuilder<
464464 ...onUpdateSet ,
465465 ...( normalizedSetValues as any ) ,
466466 } as UpdateSet < TTable > ;
467+ const writeSet = normalizeDateFieldsForWrite (
468+ this . table ,
469+ effectiveSet as any
470+ ) as UpdateSet < TTable > ;
467471
468472 const tableName = getTableName ( this . table ) ;
469473
@@ -636,7 +640,7 @@ export class ConvexUpdateBuilder<
636640
637641 const updates = await Promise . all (
638642 rows . map ( async ( row ) => {
639- const updatedRow = { ...( row as any ) , ...( effectiveSet as any ) } ;
643+ const updatedRow = { ...( row as any ) , ...( writeSet as any ) } ;
640644 const decision = await evaluateUpdateDecision ( {
641645 table : this . table ,
642646 existingRow : row as Record < string , unknown > ,
@@ -669,11 +673,11 @@ export class ConvexUpdateBuilder<
669673 continue ;
670674 }
671675 enforcePolymorphicWrite ( this . table , updatedRow , {
672- changedFields : new Set ( Object . keys ( effectiveSet as any ) ) ,
676+ changedFields : new Set ( Object . keys ( writeSet as any ) ) ,
673677 } ) ;
674678 enforceCheckConstraints ( this . table , updatedRow ) ;
675679 await enforceForeignKeys ( this . db , this . table , updatedRow , {
676- changedFields : new Set ( Object . keys ( effectiveSet as any ) ) ,
680+ changedFields : new Set ( Object . keys ( writeSet as any ) ) ,
677681 } ) ;
678682
679683 await applyIncomingForeignKeyActionsOnUpdate (
@@ -698,9 +702,9 @@ export class ConvexUpdateBuilder<
698702 ) ;
699703 await enforceUniqueIndexes ( this . db , this . table , updatedRow , {
700704 currentId : ( row as any ) . _id ,
701- changedFields : new Set ( Object . keys ( effectiveSet as any ) ) ,
705+ changedFields : new Set ( Object . keys ( writeSet as any ) ) ,
702706 } ) ;
703- await this . db . patch ( tableName , ( row as any ) . _id , effectiveSet as any ) ;
707+ await this . db . patch ( tableName , ( row as any ) . _id , writeSet as any ) ;
704708 numAffected ++ ;
705709
706710 if ( ! this . returningFields ) {
0 commit comments