Skip to content

Commit c650217

Browse files
committed
Restrict plain date strings to DateTime filters
1 parent 87483a7 commit c650217

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

packages/orm/src/client/zod/factory.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ export class ZodSchemaFactory<
854854

855855
@cache()
856856
private makeDateTimeValueSchema(): ZodType {
857-
const schema = z.union([z.iso.date(), z.iso.datetime(), z.date()]);
857+
const schema = z.union([z.iso.datetime(), z.date()]);
858858
this.registerSchema('DateTime', schema);
859859
return schema;
860860
}
@@ -865,8 +865,9 @@ export class ZodSchemaFactory<
865865
withAggregations: boolean,
866866
allowedFilterKinds: string[] | undefined,
867867
): ZodType {
868+
const filterValueSchema = z.union([z.iso.date(), this.makeDateTimeValueSchema()]);
868869
const schema = this.makeCommonPrimitiveFilterSchema(
869-
this.makeDateTimeValueSchema(),
870+
filterValueSchema,
870871
optional,
871872
() => z.lazy(() => this.makeDateTimeFilterSchema(optional, withAggregations, allowedFilterKinds)),
872873
withAggregations ? ['_count', '_min', '_max'] : undefined,

0 commit comments

Comments
 (0)