DavidTimms / DavidTimms/zod-fast-check

Add z.string().date() Refinement support

Open
#20 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
130
Forks
16
PR merge metrics
No merged PRs in 30d

Description

`z.string().date()` causes an error when `fc.sample()` because this library doesn't support the `z.string().date()` refinement. This library only supports `z.string().datetime()`:

https://github.com/DavidTimms/zod-fast-check/blob/aba467e89052ea1bb62ce6f600fa9d5d8fb5524f/src/zod-fast-check.ts#L257

Because of this, I had to export a special instance of that type and override it everywhere it's used, which obviously isn't ideal:

`export const DATE = z.string().date();`

...and then do the whole override thing referencing that instance.

Please add support for this ISO date-only-string type.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in src/zod-fast-check.ts around line 257, where z.string().datetime() support is handled. Follow that existing refinement path and add support for the ISO date-only string type, then verify that fc.sample() works with z.string().date().

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
testing
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.