From 11a410f7a064d3ba8b7b324565d08b7f6c61821f Mon Sep 17 00:00:00 2001 From: Bruno Leite Date: Wed, 25 Sep 2024 09:34:07 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20feat(zod-mock):=20update=20date?= =?UTF-8?q?=20generator=20for=20dateTime=20handling=20in=20mock=20data?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/zod-mock/src/lib/zod-mock.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/zod-mock/src/lib/zod-mock.ts b/packages/zod-mock/src/lib/zod-mock.ts index 31ebdeb..c3fe38e 100644 --- a/packages/zod-mock/src/lib/zod-mock.ts +++ b/packages/zod-mock/src/lib/zod-mock.ts @@ -195,7 +195,8 @@ function parseString( targetStringLength > 10 ? fakerInstance.lorem.word() : fakerInstance.lorem.word({ length: targetStringLength }); - const dateGenerator = () => fakerInstance.date.recent().toISOString(); + const dateGenerator = () => fakerInstance.date.recent().toISOString().substring(0,10); + const datetimeGenerator = () => fakerInstance.date.recent().toISOString(); const stringGenerators = { default: defaultGenerator, email: fakerInstance.internet.exampleEmail, @@ -204,7 +205,7 @@ function parseString( url: fakerInstance.internet.url, name: fakerInstance.person.fullName, date: dateGenerator, - dateTime: dateGenerator, + dateTime: datetimeGenerator, colorHex: fakerInstance.internet.color, color: fakerInstance.internet.color, backgroundColor: fakerInstance.internet.color,